#35520 [NEW]: Functioncs substr, str_replace, strtr and other do not work with UTF-8 string
| From: | kotysek at email dot cz | Date: | Fri, 02 Dec 2005 11:18:58 +0000 |
| Subject: | #35520 [NEW]: Functioncs substr, str_replace, strtr and other do not work with UTF-8 string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-89635@lists.php.net to get a copy of this message | ||
From: kotysek at email dot cz
Operating system: Windows XP
PHP version: 4.4.1
PHP Bug Type: *Languages/Translation
Bug description: Functioncs substr, str_replace, strtr and other do not work with UTF-8 string
Description:
------------
If I try to use almost any string function on a string with non-ascii
characters encoded in UTF-8 I get some messed up results.
This relates mainly to: substr, str_replace, strtr, strtolower,
strtoupper, strlen, ...
My string: consists of czech, slovak, german, etc. chars like è (č) ,
ň (ň) ä (ä) , ö (ö) ,...
I can't even use the most basic thing like below.
Reproduce code:
---------------
$string = "aaè"; // last character is special czech "c" (č)
echo $string[2];
Expected result:
----------------
// the code should just print "è" (č)
è
Actual result:
--------------
// it prints some character (depends on the character following "è"
Ò
--
Edit bug report at http://bugs.php.net/?id=35520&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35520&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35520&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35520&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35520&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35520&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35520&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35520&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35520&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35520&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35520&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35520&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35520&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35520&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35520&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35520&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35520&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35520&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35520&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35520&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35520&r=mysqlcfg