#47742 [Fbk->Opn]: mb_strtoupper() and mb_strtolower() failure cases

From: Date: Thu, 07 May 2009 13:57:30 +0000
Subject: #47742 [Fbk->Opn]: mb_strtoupper() and mb_strtolower() failure cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136943@lists.php.net to get a copy of this message
ID: 47742 User updated by: fsb at thefsb dot org Reported By: fsb at thefsb dot org -Status: Feedback +Status: Open Bug Type: mbstring related Operating System: os x PHP Version: 5.2.9 New Comment: jani, that looks like an improvement. should i try out the may 7 snapshot? Previous Comments: ------------------------------------------------------------------------ [2009-05-06 21:10:01] jani@php.net Ignore the previous, this bad bug system messed up the input. :) Here's the actual stuff: http://pecl.php.net/~jani/bug47742.out ------------------------------------------------------------------------ [2009-05-06 21:07:33] jani@php.net This script: <?php $s = '&#935;&#953;&#972;&#957;&#953;&#945;, &#946;&#961;&#959;&#967;&#941;&#962; &#954;&#945;&#953; &#952;&#965;&#949;&#955;&#955;&#974;&#948;&#949;&#953;&#962; &#940;&#957;&#949;&#956;&#959;&#953; &#963;&#965;&#957;&#952;&#941;&#964;&#959;&#965;&#957; &#964;&#959;'; echo "orig: $s\n"; $s = mb_strtoupper($s); echo "mb_strtoupper: $s\n"; $s = mb_convert_case($s, MB_CASE_UPPER, "UTF-8"); echo "mb_convert_case (upper): $s\n"; $s = mb_strtolower($s); echo "mb_strtolower: $s\n"; $s = mb_convert_case($s, MB_CASE_LOWER, "UTF-8"); echo "mb_convert_case (lower): $s\n"; ?> Outputs: orig: &#935;&#953;&#972;&#957;&#953;&#945;, &#946;&#961;&#959;&#967;&#941;&#962; &#954;&#945;&#953; &#952;&#965;&#949;&#955;&#955;&#974;&#948;&#949;&#953;&#962; &#940;&#957;&#949;&#956;&#959;&#953; &#963;&#965;&#957;&#952;&#941;&#964;&#959;&#965;&#957; &#964;&#959; mb_strtoupper: &#935;&#921;&#908;&#925;&#921;&#913;, &#914;&#929;&#927;&#935;&#904;&#931; &#922;&#913;&#921; &#920;&#933;&#917;&#923;&#923;&#911;&#916;&#917;&#921;&#931; &#902;&#925;&#917;&#924;&#927;&#921; &#931;&#933;&#925;&#920;&#904;&#932;&#927;&#933;&#925; &#932;&#927; mb_convert_case (upper): &#935;&#921;&#908;&#925;&#921;&#913;, &#914;&#929;&#927;&#935;&#904;&#931; &#922;&#913;&#921; &#920;&#933;&#917;&#923;&#923;&#911;&#916;&#917;&#921;&#931; &#902;&#925;&#917;&#924;&#927;&#921; &#931;&#933;&#925;&#920;&#904;&#932;&#927;&#933;&#925; &#932;&#927; mb_strtolower: &#967;&#953;&#972;&#957;&#953;&#945;, &#946;&#961;&#959;&#967;&#941;&#963; &#954;&#945;&#953; &#952;&#965;&#949;&#955;&#955;&#974;&#948;&#949;&#953;&#963; &#940;&#957;&#949;&#956;&#959;&#953; &#963;&#965;&#957;&#952;&#941;&#964;&#959;&#965;&#957; &#964;&#959; mb_convert_case (lower): &#967;&#953;&#972;&#957;&#953;&#945;, &#946;&#961;&#959;&#967;&#941;&#963; &#954;&#945;&#953; &#952;&#965;&#949;&#955;&#955;&#974;&#948;&#949;&#953;&#963; &#940;&#957;&#949;&#956;&#959;&#953; &#963;&#965;&#957;&#952;&#941;&#964;&#959;&#965;&#957; &#964;&#959; And this is quite correct.. ------------------------------------------------------------------------ [2009-05-05 11:37:26] fsb at thefsb dot org in both test scripts i provided yesterday, the character set is unicode and the encoding is utf-8. in the short test script that i provided 4 May 7:02pm UTC, there is only one short Hangul test string and no Greek, as you said. in the longer test script i provided at 4 May 5:00pm UTC, several alphabets are used including Greek, Cyrillic, Hebrew, Arabic, Thai, Kanji, ... in case it makes life easier for you, i put the longer test script on a web server: http://tomworster.net/test.php.gz it's only 1kbyte. ------------------------------------------------------------------------ [2009-05-05 02:02:39] jani@php.net One last question: What is the charset you used? I don't see any greek chars anywhere.. ;) ------------------------------------------------------------------------ [2009-05-04 19:02:43] fsb at thefsb dot org <?php $s = '이며 세계'; print(phpversion() . "\n"); print("1: $s\n"); print('2: '. ($s = mb_strtoupper($s)) . "\n"); print('3'. ($s = mb_convert_case($s, MB_CASE_UPPER, "UTF-8")) . "\n"); print('4: '. ($s = mb_strtolower($s)) . "\n"); print('5: '. ($s = mb_convert_case($s, MB_CASE_LOWER, "UTF-8")) . "\n"); ?> ./php -f test2.php 5.2.10-dev 1: 이며 세계 2: ̝?˩? ̄?ʳ? 3̝˩ ̄ʳ 4: ?? ?? 5: expected output: 1: 이며 세계 2: 이며 세계 3: 이며 세계 4: 이며 세계 5: 이며 세계 ------------------------------------------------------------------------ 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/47742 -- Edit this bug report at http://bugs.php.net/?id=47742&edit=1

« previous php.bugs (#136943) next »