[philiptellis] /bb|[^b]{2}/
Never stop Grokking


Tuesday, October 07, 2008

Platform dependent locales

Here's a simple snippet of PHP code:
        setlocale(LC_TIME, 'de_CH.UTF-8');
echo strftime("%x");
I run this on RHEL5 and Ubuntu 8.04 and I get different results:

RHEL5:
       2008-10-07
Ubuntu 8.04:
       07.10.2008
So I look through /usr/share/i18n/locales/de_CH for a hint, and I find it.

On RHEL, d_fmt in LC_TIME maps to <u0025><u0059><u002d><u0025><u006d><u002d><u0025><u0064>, which in English, is %Y-%m-%d, while on Ubuntu, it maps to <u0025><u0064><u002e><u0025><u006d><u002e><u0025><u0059>, which in English is, %d.%m.%Y, which is exactly where this discrepancy arises from.

Now I have no idea how to verify which is more recent, because Ubuntu and RHEL do not package things in the same way. Any ideas?

2 comments :

david koblas
October 24, 2008 2:15 AM

locale is part of ICU http://www.icu-project.org/index.html , which in their info browser shows the '.' version as correct (de_CH inherited this from the de locale)

Blues
October 24, 2008 2:27 AM

Thanks David.

Post a Comment

...===...