[darcs-users] darcs patch: Remove home-grown UTF-8 decoder, use utf... (and 1 more)
Trent W. Buck
twb at cybersource.com.au
Mon Sep 7 01:11:28 UTC 2009
Reinier Lamers <tux_rocker at reinier.de> writes:
>> if which locale; then
>> latin9_locale=latin9_locale=`locale -a | grep @euro | head -n 1`
>> else
>> latin9_locale=en_US.ISO-8859-1
>> fi
>>
>> or if it is really required, exit 200 in the else branch.
>
> At least my Ubuntu doesn't actually use a locale it doesn't
> recognize. So when you just set your LC_ALL to say that you want
> latin1, but you have not enabled the latin1 locale you specified, it
> will use the C locale. That's the problem I tackled with the 'locale
> -a | grep' stuff. If we exit 200 in the else branch, we may be
> effectively testing this on Linux only, which is not good either.
>
> Maybe locale-switching is inherently unportable and we have to settle
> for testing this only on Linux. But maybe our Unix guru Trent knows a
> way out?
I have always relied on locale(1) for this stuff. Why do we need to
override the locale in this script?
Note that even if locale(1) is installed, there may be no @euro locale
provided, such as on my laptop:
$ locale -a | fmt
C POSIX en_AU en_AU.iso88591 en_AU.utf8
FWIW, I have a /usr/bin/locale on SunOS 5.8 (Last change: 20 Dec 1996).
http://www.opengroup.org/onlinepubs/009695399/utilities/locale.html
indicates it was part of the 2003 POSIX.1 spec.
More information about the darcs-users
mailing list