Prev: Reprenez le contrôle de votre téléphonie
Next: Unstable, LVM and Grub2: "error: you need to load the kernel first"
From: Mathieu Malaterre on 30 Nov 2009 10:30 Hi there, My computer is setup so that default locale is en_US.utf8. In order to do some testing with LC_NUMERIC. I decided to install more locale (dpkg-reconfigure locales). Now I have: $ locale -a C en_US.utf8 fr_FR.utf8 POSIX However I am still missing something to get LC_NUMERIC working. For instance in my shell: $ LC_NUMERIC=fr_FR.utf8 zsh -c 'float a=1; echo $(( a / 3 ))' 0.33333333333333331 Which is clearly wrong. What are the steps that I missed to get locale properly setup ? Thanks, -- Mathieu -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
From: Sven Joachim on 30 Nov 2009 11:00
On 2009-11-30 16:25 +0100, Mathieu Malaterre wrote: > My computer is setup so that default locale is en_US.utf8. In order > to do some testing with LC_NUMERIC. I decided to install more locale > (dpkg-reconfigure locales). Now I have: > > $ locale -a > C > en_US.utf8 > fr_FR.utf8 > POSIX > > However I am still missing something to get LC_NUMERIC working. For > instance in my shell: > > > $ LC_NUMERIC=fr_FR.utf8 zsh -c 'float a=1; echo $(( a / 3 ))' > 0.33333333333333331 > > Which is clearly wrong. It might not have been what you expected. > What are the steps that I missed to get locale properly setup ? None. It is zsh that explicitly calls setlocale(LC_NUMERIC, "POSIX") when doing floating point arithmetic, because otherwise scripts doing that would depend on the locale. This is documented in zshparam(1): ,---- | LC_NUMERIC <S> | This variable affects the decimal point character and thousands | separator character for the formatted input/output functions and | string conversion functions. Note that zsh ignores this setting | when parsing floating point mathematical expressions. `---- Sven -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org |