#19257 [Bgs]: strtolower & strtoupper does not work for UTF-8 strings

From: Date: Tue, 10 Sep 2002 13:44:36 +0000
Subject: #19257 [Bgs]: strtolower & strtoupper does not work for UTF-8 strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18925@lists.php.net to get a copy of this message
ID: 19257 User updated by: gamid@isayev.net Reported By: gamid@isayev.net Status: Bogus Bug Type: Strings related Operating System: Linux PHP Version: 4.2.2 New Comment: > So you didn't try it..? Yes, I set LC_ALL/LANG to 'en_US' and try it. > I only tried your test script and got the expected result. > Whatever the characters are.. I've no idea of them anyway.. I think your confused by looking on the result of test script with encoding set to 'ISO-8859-x' instead of 'UTF-8'. In this case it looks as some characters changed to lower/upper case. BUT they are not UTF-8 lower/upper case characters: 1) 0xC39C changed to 0xE39C, should be 0xC3BC 2) 0xD0AF changed to 0xF0AF, should be 0xD18F As result we have not UTF-8 string but a garbage. If you really like test this issue you should set 'default_charset=utf-8' in php.ini or set encoding to 'UTF-8' in your browser. > btw. AFAIK, setting LANG / LC_ALL to UTF-8 is not correct > way to do it.. > According to that HOWTO, it should be something like > ru_RU.UTF-8 (and only if you really have UTF-8 locales) I try en_US.UTF-8, de_DE.UTF-8, ru_RU.UTF-8 - no lack. > I'm bogusing this since it really isn't anything PHP can > affect.. So, no way in PHP convert UTF-8 string to lower/upper case? Previous Comments: ------------------------------------------------------------------------ [2002-09-09 17:06:43] sniper@php.net So you didn't try it..? I only tried your test script and got the expected result. Whatever the characters are..I've no idea of them anyway.. btw. AFAIK, setting LANG / LC_ALL to UTF-8 is not correct way to do it.. http://melkor.dnp.fmph.uniba.sk/~garabik/debian-utf8/howto.h tml According to that HOWTO, it should be something like ru_RU.UTF-8 (and only if you really have UTF-8 locales) I'm bogusing this since it really isn't anything PHP can affect.. ------------------------------------------------------------------------ [2002-09-09 11:28:45] gamid@isayev.net > I tried setting LANG/LC_ALL to that and it indeed > didn't work. When I set those to "en_US" it works just fine. What you mean "works just fine"? Did it convert 0xC39C ('Ü' in UTF-8 encoding) into 0xC3BC ('ü' in UTF-8 encoding)? Or 0xD0AF (Russian capital "ya" in UTF-8 encoding) into 0xD18F (Russian lowercase "ya" in UTF-8 encoding)? ------------------------------------------------------------------------ [2002-09-09 10:45:05] sniper@php.net I didn't know UTF-8 is a locale.. I tried setting LANG/LC_ALL to that and it indeed didn't work. When I set those to "en_US" it works just fine. ------------------------------------------------------------------------ [2002-09-09 08:39:06] gamid@isayev.net > Exactly what distribution do you have? Mandrake 8.1 with following RPMs installed: locales-2.3.1.2-4mdk locales-en-2.3.1.2-4mdk locales-ru-2.3.1.2-4mdk locales-de-2.3.1.2-4mdk > How are LANG/LANGUAGE/LC_ALL etc. environment variables > set in your system (before starting Apache)..? All environment variables set to 'UTF-8'. > And please, try with the stock php.ini-dist too. Same result. BTW, in the php.ini-dist there should be a semi-colon instead of colon in the line 98: ": is doing." -> "; is doing." Could you tell me your settings so that I can try them out? ------------------------------------------------------------------------ [2002-09-07 14:20:53] sniper@php.net Exactly what distribution do you have? How are LANG/LANGUAGE/LC_ALL etc. environment variables set in your system (before starting Apache)..? And please, try with the stock php.ini-dist too. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/19257 -- Edit this bug report at http://bugs.php.net/?id=19257&edit=1

« previous php.bugs (#18925) next »