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

From: Date: Thu, 05 Sep 2002 22:02:35 +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-18544@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: I did backport of strtolower() & strtoupper() from the latest string.c (rev.1.290). The fuctions still does not work: loc = 'UTF-8' str = 'Testü' strU = 'TESTü' strL = 'testü' Since I am not sure that you entered the UTF-8 symbols correctly, here's a modified version of the code that creates the desired test string: <? $str = "Test".utf8_encode("\xFC"); $loc = "UTF-8"; putenv("LANG=$loc"); $loc = setlocale(LC_ALL, $loc); $strU = strtoupper($str); $strL = strtolower($str); ?> <PRE> loc = '<? echo $loc; ?>' str = '<? echo $str; ?>' strU = '<? echo $strU; ?>' strL = '<? echo $strL; ?>' </PRE> Previous Comments: ------------------------------------------------------------------------ [2002-09-05 16:02:55] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip I can't reproduce this with PHP 4.3.0-dev. ------------------------------------------------------------------------ [2002-09-05 15:46:14] gamid@isayev.net Functions strtolower() & strtoupper() does not change UTF-8 strings. I try Russian (0x042F, 0x044F) and German (0x00DC, 0x00FC) characters. Example: <? $str = "testЯ"; $loc = "UTF-8"; putenv("LANG=$loc"); $loc = setlocale(LC_ALL, $loc); $strU = strtoupper($str); $strL = strtolower($str); ?> <PRE> loc = '<? echo $loc; ?>' str = '<? echo $str; ?>' strU = '<? echo $strU; ?>' strL = '<? echo $strL; ?>' </PRE> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19257&edit=1

« previous php.bugs (#18544) next »