#46402 [NEW]: Incorrect case convertions of native letters, after using setlocale
| From: | kvv at nightmail dot ru | Date: | Mon, 27 Oct 2008 13:18:26 +0000 |
| Subject: | #46402 [NEW]: Incorrect case convertions of native letters, after using setlocale | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-1259@lists.php.net to get a copy of this message | ||
From: kvv at nightmail dot ru
Operating system: FreeBSD 6.3
PHP version: 5.2.6
PHP Bug Type: *Languages/Translation
Bug description: Incorrect case convertions of native letters, after using setlocale
Description:
------------
After setting script locale to ru_RU.UTF-8, behavior of functions
strtoupper and atrtolower becomes unpredictable. Function setlocale,
reports that encoding is setted to desired. But case conversion make
no changes or change letters incorrectly (results may vary).
Reproduce code:
---------------
<?php
header('Content-type: text/html; charset=utf-8');
$sL = 'àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ'; // lower
russian alphabet,
source file must be in utf-8 encoding
$sU = 'ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß'; // upper
russian alphabet
echo setlocale(LC_ALL, 'ru_RU.UTF-8') .'<br>';
echo 'Lower to upper:<br>';
echo strtoupper($sL) .'<br>'; // incorrect result
echo mb_strtoupper($sL, 'utf-8') .'<br>'; // correct result, for
comparsion
echo 'Upper to lower:<br>';
echo strtolower($sU) .'<br>'; // incorrect result
echo mb_strtolower($sU, 'utf-8') .'<br>'; // correct result, for
comparsion
?>
Expected result:
----------------
ru_RU.UTF-8
Lower to upper:
ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß
ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß
Upper to lower:
àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ
àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ
Actual result:
--------------
ru_RU.UTF-8
Lower to upper:
àáâãä̸æçèéêëìíîïðñòóôõö÷øùúûüýþÿ
ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß
Upper to lower:
���������������������������������
àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿ
--
Edit bug report at http://bugs.php.net/?id=46402&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46402&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46402&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46402&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46402&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46402&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46402&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46402&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46402&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46402&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46402&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46402&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46402&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46402&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46402&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46402&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46402&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46402&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46402&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46402&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46402&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46402&r=mysqlcfg