Edit report at http://bugs.php.net/bug.php?id=54148&edit=1
ID: 54148 Updated by: [email protected] Reported by: jrs at bluekiwi-software dot com Summary: substr does not return correct substring -Status: Open +Status: Bogus Type: Bug Package: *Unicode Issues Operating System: Windows 7 PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: david@copenhagen:~/test$ /home/david/dev/php/php53/sapi/cli/php -v PHP 5.3.6-dev (cli) (built: Feb 26 2011 23:29:38) (DEBUG) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies david@copenhagen:~/test$ /home/david/dev/php/php53/sapi/cli/php t.php string(31) "무ë£ìë² ì´ì©ìì ëë¤" string(6) "무ë£" david@copenhagen:~/test$ cat t.php <?php $var = '무ë£ìë² ì´ì©ìì ëë¤'; var_dump($var); $var = mb_substr($var, 0, 2, 'utf-8'); var_dump($var); david@copenhagen:~/test$ Previous Comments: ------------------------------------------------------------------------ [2011-03-03 12:07:10] jrs at bluekiwi-software dot com Description: ------------ --- >From manual page: http://www.php.net/function.mb-substr#Return Values --- tested with korean caracters. Test script: --------------- header('Content-Type: text/html; charset=UTF-8'); $var = '무ë£ìë² ì´ì©ìì ëë¤'; var_dump($var); echo "<br />"; $var = mb_substr($var, 0, 2); var_dump($var); Expected result: ---------------- 무ë£ìë² ì´ì©ìì ëë¤ ë¬´ë£ Actual result: -------------- 무ë£ìë² ì´ì©ìì ëë¤ ï¿½ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54148&edit=1
