From: Operating system: WinXP, Linux Debian PHP version: Irrelevant Package: Strings related Bug Type: Bug Bug description:$str[] unexpected result with multibyte character
Description: ------------ When you access a multibyte character in an UTF-8 encoded string using array brackets [] it only returns the first byte instead of the full character. WindowsXP SP3 PHP 5.3.0 WindowsXP SP3 PHP 5.3.2 Linux Debian PHP 5.2.6-1+lenny8 Linux Debian PHP 5.3.2-0.dotdeb.2 PHP Ini settings: default_charset = "utf-8" mbstring.internal_encoding = UTF-8 mbstring.func_overload = 7 http://us.php.net/manual/en/language.types.string.php#language.types.string.substr Test script: --------------- <?php $sStr = "André"; var_dump($sStr); var_dump($sStr[4]); ?> Expected result: ---------------- string(6) "André" string(1) "é" Actual result: -------------- string(6) "André" string(1) "�" -- Edit bug report at http://bugs.php.net/bug.php?id=51919&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51919&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51919&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=51919&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=51919&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51919&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51919&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51919&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51919&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51919&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51919&r=support Expected behavior: http://bugs.php.net/fix.php?id=51919&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51919&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51919&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51919&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51919&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51919&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51919&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51919&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51919&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51919&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51919&r=mysqlcfg
