|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-03-14 01:26 UTC] mwalker at wikimedia dot org
Description: ------------ I have a UTF-8 PHP file that initializes an array of characters depending on the locale. Some of these are multibyte strings. When using the number_format() function with $dec_point, or $thousands_sep set with one of these multibyte entries the returned result contains only the first byte of the string (which is only a partial code point.) Test script: --------------- $foo = "\xC2\xA0"; $result = number_format(1.23, $foo, $foo); Expected result: ---------------- $result to contain "\x31\xC2\xA0\x32\x33" Actual result: -------------- $result seems to contain "\x31\xC2\x32\x33" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
Note that it is easy enough to substitute single-char placeholders for now while you are still stuck on 5.3: $f = number_format((float)$val, $precision, 'X', 'Y'); $f = str_replace(array('X','Y'), array($decsep,$thousep), $f); Not pretty, but effective.