[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/xml/tests 007.phpt
I wrote about fun with locales, but forgot to mention the user notes at http://www.php.net/manual/de/function.setlocale.php. Some users note that they have to use Dutch on their Windows (?) systems. So if we really need the locale guessing, we probably should add German as well (and hope that the locale string is not localized in some versions of Windows). Regards... Michael -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/xml/tests 007.phpt
Derick Rethans [EMAIL PROTECTED] wrote: On Mon, 21 Oct 2002, Melvyn Sopacua wrote: msopacua Mon Oct 21 04:55:07 2002 EDT Modified files: /php4/ext/xml/tests 007.phpt Log: Skip this when strtoupper doesn't behave as expected, because casefolding depends on this. erm, this is just a local problem. Just set the locale to German here and it will work just fine I think. IMO this is a hack :) The problem is that there are an awful lot of German locales. Something like setlocale(LC_ALL,array('de_DE.ISO8859-1','de_DE.ISO8859-15', 'de_DE@euro','de','de_DE')); and some more variations with - or _ after the ISO, or even DIS instead of ISO, might work for most platforms that have a German locale installed. But because some systems don't have a German locale at all (IIRC on Debian you have to install your locales explicitly and run locale-gen afterwards), en_US and it's variations might be more promising: foreach(array('','_','-') as $hyphen) foreach(array('ISO','DIS') as $ISODIS) $locales[] = en_US.${ISODIS}${hyphen}8859-1\n; $locales[] = 'en_US@euro'; $locales[] = 'en_US'; $locales[] = 'en'; setlocale(LC_ALL,$locales); Nice, isn't it? There's a good page about that at http://www.uni-ulm.de/~s_smasch/locale/ (in English). There's also a small C program called checklocale. But even if we use such a locale guessing: it's not the fault of the XML code if non-ASCII characters don't work. It might be a good idea to have a seperate test case for strtoupper() etc., but for testing the XML extension, I still think that's it's better to just bail out as soon as we see that strtoupper() doesn't behave. Maybe we should add setlocale(LC_ALL,''); at the beginning of ext/xml/tests/007.phpt to make sure that the locale settings of the environment are used (although here the values of the environment are used even without that statement). Regards... Michael -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/xml/tests 007.phpt
[ Sorry Derick, missed a whole bunch of CVS mail, because of multiple spaces in the subject and my overeager filtering :) ] At 23:58 21-10-2002, Michael Mauch wrote: Derick Rethans [EMAIL PROTECTED] wrote: On Mon, 21 Oct 2002, Melvyn Sopacua wrote: msopacua Mon Oct 21 04:55:07 2002 EDT Modified files: /php4/ext/xml/tests 007.phpt Log: Skip this when strtoupper doesn't behave as expected, because casefolding depends on this. erm, this is just a local problem. Just set the locale to German here and it will work just fine I think. IMO this is a hack :) The problem is that there are an awful lot of German locales. While I agree, the only thing that should be needed is LC_CTYPE to ISO-8859-1, which is somewhat managable (ISO8859=1 is the most portable I think?). IIC - Michael is right that locale names are even less consistent, than a lawyer. So you can either setlocale(LC_CTYPE, some string) then test if it works, maybe try again with other string, but you can't grab'm all. Apart from that: [EMAIL PROTECTED] ~/cvs/php4 $ /php/bin/php -f ext/standard/tests/strings/strtoupper.phpt --TEST-- Test strtoupper on non-ASCII characters --POST-- --GET-- --FILE-- ÀËÏ--EXPECT-- ÄËÏ [EMAIL PROTECTED] ~/cvs/php4 $ sapi/cli/php -f ext/standard/tests/strings/strtoupper.phpt --TEST-- Test strtoupper on non-ASCII characters --POST-- --GET-- --FILE-- àëï--EXPECT-- ÄËÏ /php/bin/php is 4.2.3 so something has changed not for the better :( Should I file a bugreport? Met vriendelijke groeten / With kind regards, Webmaster IDG.nl Melvyn Sopacua -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php