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

From: Date: Sat, 07 Sep 2002 19:20:54 +0000
Subject: #19257 [Opn->Fbk]: strtolower & strtoupper does not work for UTF-8 strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18635@lists.php.net to get a copy of this message
 ID:               19257
 Updated by:       sniper@php.net
 Reported By:      gamid@isayev.net
-Status:           Open
+Status:           Feedback
 Bug Type:         Strings related
 Operating System: Linux
 PHP Version:      4.2.2
 New Comment:

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.




Previous Comments:
------------------------------------------------------------------------

[2002-09-06 13:29:57] gamid@isayev.net

BTW, here is my configuration:

./configure \
  --with-apxs=/usr/sbin/apxs \
  --enable-track-vars \
  --enable-safe-mode \
  --with-config-file-path=/etc/httpd \
  --with-zlib \
  --enable-magic-quotes \
  --with-regex=system \
  --without-mysql \
  --without-xml \
  --without-gd \
  --with-pgsql=shared \
  --with-imap \
  --with-iconv \
  --enable-mbstring \
  --with-xml \
  --with-kerberos

php.ini has 'default_charset=utf-8'.

------------------------------------------------------------------------

[2002-09-06 13:27:36] gamid@isayev.net

The functions do not work in PHP 4.2.3 and latest snapshot.

------------------------------------------------------------------------

[2002-09-05 17:24:20] gamid@isayev.net

> Don't try to patch..you're not doing it right anyway.
:)

> Just pull the snapshot and try with it.
Ok

PHP: 20020307
PHP Extension: 20020429
Zend Extension: 20020903

Output:
loc  = 'UTF-8'
str  = 'Testü'
strU = 'TESTü'
strL = 'testü'

------------------------------------------------------------------------

[2002-09-05 17:09:34] sniper@php.net

Output: 

str  = 'Testü'
strU = 'TESTü'
strL = 'testã¼'

Don't try to patch..you're not doing it right anyway.
Just pull the snapshot and try with it.


------------------------------------------------------------------------

[2002-09-05 17:02:35] gamid@isayev.net

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>

------------------------------------------------------------------------

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



Thread (18 messages)

« previous php.bugs (#18635) next »