Doc #53113 [NEW]: number_format(): wrong usage of term "character" in multi-byte context

From: Date: Wed, 20 Oct 2010 11:41:29 +0000
Subject: Doc #53113 [NEW]: number_format(): wrong usage of term "character" in multi-byte context
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5291@lists.php.net to get a copy of this message
From: Operating system: - PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:number_format(): wrong usage of term "character" in multi-byte context Description: ------------ "Only the first character of thousands_sep is used. For example, if you use & as thousands_sep on the number 1000, number_format() will return 1&000." This example is based on US-ASCII or other one-byte character sets. If for example the *single character* "ü" in UTF-8 is used, the byte-representation is two byte (I might be wrong, but this is not relevant). The function number_format() uses the *first byte* of that character, resulting in something broken, like broken UTF-8. Expected result: ---------------- Add the following note: Multi-byte characters are *not* supported in this function, as only the first byte will be used, resulting in broken encoding. Furthermore: Only "thousands_sep" has this notice as of now, but according to my tests, the same applies to "dec_point". So please add the note above there as well. Actual result: -------------- > php -r "var_dump(number_format(123456789.123, 4, 'ö', > 'ä'));" string(16) "123�456�789�1230" -- Edit bug report at http://bugs.php.net/bug.php?id=53113&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53113&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53113&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53113&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53113&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53113&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53113&r=support Expected behavior: http://bugs.php.net/fix.php?id=53113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53113&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53113&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53113&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53113&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53113&r=mysqlcfg

« previous php.doc.bugs (#5291) next »