Edit report at http://bugs.php.net/bug.php?id=51919&edit=1

 ID:               51919
 Updated by:       [email protected]
 Reported by:      msluis at sellvation dot nl
 Summary:          $str[] unexpected result with multibyte character
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Strings related
 Operating System: WinXP, Linux Debian
 PHP Version:      Irrelevant

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP has no idea about"characters"just bytes.


Previous Comments:
------------------------------------------------------------------------
[2010-05-26 11:53:19] msluis at sellvation dot nl

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 this bug report at http://bugs.php.net/bug.php?id=51919&edit=1

Reply via email to