# jochem@xxxxxxxxxxxxx / 2006-11-03 22:18:03 +0100: > Roman Neuhauser wrote: > > # jochem@xxxxxxxxxxxxx / 2006-11-03 16:16:11 +0100: > >> Roman Neuhauser wrote: > >>> # jochem@xxxxxxxxxxxxx / 2006-11-03 14:51:39 +0100: > >>>> 1. running the command 'locale -a' returns the following [shortened] list: > >>>> > > ... > > > > >>>> in fact I can set any installed locale I want on the commandline BUT > >>>> trying to set any other than the originally installed "nl_NL@euro" in > >>>> code running via Apache results in FALSE being returned and the locale > >>>> not being set. > >>>> > >>>> has anybody got a clue for me? > >>> You don't mention what warning(s) the failing setlocale() call produces. > >> it just returns false, telling me that the chosen locale(s) was/were not set - there > >> is no PHP error at all. > > > > I just checked the setlocale() code (in HEAD), and surely it can > > return false without a warning, it can even be an almost empty (and > > just as quiet) stub that just returns false, depending on the value > > of HAVE_SETLOCALE during compilation. > > thank you for doing this ... turns out that indeed the locale is being set > but the return value is false, I've settled for not checking the return value and > just assuming (blindly hoping) the setlocale worked - I don't really know what > else there is to do, besides ik works :-) How did you confirmed that the locale got set? > > Try a simple CGI script, does > > locale manipulation succeed there? > > I'd have to look up how to setup a php-cgi ... It doesn't have to be written in PHP. Compile the following program and try it from the command line: #include <errno.h> #include <string.h> #include <stdio.h> #include <locale.h> int main(int argc, char **argv) { if (2 > argc) { return printf("usage: %s <locale>\n", *argv); } char *old = setlocale(LC_ALL, NULL); printf("old: %p \"%s\"\n", old, old); char *loc = setlocale(LC_ALL, argv[1]); char *check = setlocale(LC_ALL, NULL); printf("check: %p \"%s\"\n", check, check); if (0 == loc) { printf("setlocale: \"%s\"\n", strerror(errno)); return 1; } return printf("new: %p \"%s\"\n", loc, loc); } Put "AddHandler cgi-script .cgi" in your apache config and call the above from the script below, does the output differ? foo.cgi: #!/bin/sh printf "Content-Type: text/plain\r\n\r\n" /path/to/the-above-program en_GB -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php