Edit report at https://bugs.php.net/bug.php?id=64424&edit=1
ID: 64424 User updated by: mwalker at wikimedia dot org Reported by: mwalker at wikimedia dot org Summary: number_format is not multibyte safe Status: Closed Type: Bug Package: *Unicode Issues Operating System: Ubuntu 12.04 PHP Version: 5.3.22 Assigned To: nikic Block user comment: N Private report: N New Comment: Awesome -- good to hear this has been fixed. Sadly I'm stuck on 5.3 for the present time. Good tip on the intl extension -- haven't explored it in as much depth as I should -- so thanks :) Previous Comments: ------------------------------------------------------------------------ [2013-03-14 07:07:30] paj...@php.net Also I strongly recommend to move to Intl instead. http://www.php.net/manual/en/numberformatter.format.php ------------------------------------------------------------------------ [2013-03-14 07:02:26] ni...@php.net Support for this has already been added in PHP 5.4. See the changelog from http://php.net/number_format: 5.4.0 This function now supports multiple bytes in dec_point and thousands_sep. Only the first byte of each separator was used in older versions. ------------------------------------------------------------------------ [2013-03-14 01:26:36] 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" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64424&edit=1