|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-09 18:59 UTC] cataphract@php.net
[2011-04-09 18:59 UTC] cataphract@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cataphract
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 23:00:02 2025 UTC |
Description: ------------ Iterating the characters of a UTF-32LE encoded string by using mb_substr() fails. Same string UTF-32BE encoded works as expected. Test script: --------------- <?php declare(encoding = 'UTF-8'); mb_internal_encoding('UTF-8'); header('Content-Type: text/plain; charset=UTF-32LE'); $string = "hällö wörld\n"; $string = mb_convert_encoding($string, "UTF-32LE"); $length = mb_strlen($string, "UTF-32LE"); echo mb_convert_encoding("Length: ". $length ."\n", "UTF-32LE"); echo $string; for ($i=0; $i < $length; $i++) { echo mb_substr($string, $i, 1, "UTF-32LE"); } ?> Expected result: ---------------- Length: 12 hällö wörld hällö wörld Actual result: -------------- Length: 12 hällö wörld häl