From owner-freebsd-stable@FreeBSD.ORG Thu Nov 16 14:27:06 2006 Return-Path: X-Original-To: freebsd-stable@FreeBSD.ORG Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E05916A412 for ; Thu, 16 Nov 2006 14:27:06 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1C7343D72 for ; Thu, 16 Nov 2006 14:27:05 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (ripyjs@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id kAGEQxbG066611; Thu, 16 Nov 2006 15:27:04 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id kAGEQwC4066610; Thu, 16 Nov 2006 15:26:58 +0100 (CET) (envelope-from olli) Date: Thu, 16 Nov 2006 15:26:58 +0100 (CET) Message-Id: <200611161426.kAGEQwC4066610@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG, om-lists-bsd@omx.ch In-Reply-To: <4685C92E-8B28-493A-BBFB-79A50F617970@omx.ch> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Thu, 16 Nov 2006 15:27:04 +0100 (CET) Cc: Subject: Re: linux locales to freebsd: symlink to make php setlocale() happy ? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-stable@FreeBSD.ORG, om-lists-bsd@omx.ch List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2006 14:27:06 -0000 Olivier Mueller wrote: > While moving some more customers from a linux to a freebsd-based > hosting, like some others I had a problem with php pages using > setlocale(). > > According to 'locale -a', it looks like that for de_DE (german): > > Linux (suse): > de_DE > de_DE.utf8 > de_DE@euro > > FreeBSD (6.1): > de_DE.ISO8859-1 > de_DE.ISO8859-15 > de_DE.UTF-8 There's no standard for locale names (and it shouldn't be necessary anyway). > And in the customers code, the call which hadn't worked anymore is: > setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'). It's bad design to hardcode locale names in programs. It's much better (and standard practice) to pick up the locale from the environment variables, so they can be configured in the environment, without having to hack the program. > I could tell the customer to update his code and add "de_DE.ISO8859-1" > to his setlocale() list, You could also tell the customer to fix that crap and use environment variables. :-) > but he will ask me "why isn't it like before?" The answer is "because your program was written in a non- portable way and needs to be fixed". > So what would be the "cleanest" solution? The cleanest solution is certainly to fix the program. > Is there an options somewhere > to add the "standard" de_DE-like label (xx_XX) to all languages? Not that I'm aware of. It's not a standard anyway, and I even consider it bad practice because the character set specification is missing, so it's ambiguous. > Or should I use symlinks like: > [root@bsd /usr/share/locale]# ln -s de_DE.ISO8859-1 de_DE Well, that would be a work-around that should work. It's not really a "clean solution", though. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "If you aim the gun at your foot and pull the trigger, it's UNIX's job to ensure reliable delivery of the bullet to where you aimed the gun (in this case, Mr. Foot)." -- Terry Lambert, FreeBSD-hackers mailing list.