Page 1 of 1

setlocale problem

PostPosted: 23. August 2007 19:51
by Macuyiko
Hi, I'm having a problem with the following PHP function:

setlocale(LC_ALL,'en_US.utf-8');

It always returns false when using lampp-apache. setlocale(LC_ALL, 0) returns 'C'. No matter which locale I try to set, the function always returns false.

I tried executing system('locale -a'); to see if the locales where present on my system, they were.

I'm running xampp on Ubuntu. Note that when using the Apache/PHP installation provided by Ubuntu packages, the code works fine.

I've also tried setting the locale to something which was listed in /opt/lampp/share/locale/locale.alias. Which didn't work.

Any ideas any-one? (How can I force xampp to use my system locales instead of the /opt/lampp/share/locale ones?) I really need this function because otherwise all utf-8 characters with accents or umlauts get displayed as question marks (?). (This happens server-side and has nothing to do with browser-settings.)

Thanks

PostPosted: 23. August 2007 21:24
by Macuyiko
Bump: could anybody post a locale that should work with the default lampp installation. It seems the only working locale is the fallback "C"... I also tried copying my system locales to /opt/lampp/share/locale.

PostPosted: 24. August 2007 14:45
by skuipers
Have you tried to set a symbolic link from /opt/lampp/share/locale to /usr/share/locale?