Doc #54263 [NEW]: htmlspecialchars - charsets are not equivalent

From: Date: Wed, 16 Mar 2011 02:35:47 +0000
Subject: Doc #54263 [NEW]: htmlspecialchars - charsets are not equivalent
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6078@lists.php.net to get a copy of this message
From: Operating system: PHP version: 5.3.5 Package: Documentation problem Bug Type: Documentation Problem Bug description:htmlspecialchars - charsets are not equivalent Description: ------------ --- From manual page: http://www.php.net/function.htmlspecialchars#Parameters --- For the purposes of this function, the charsets ISO-8859-1, ISO-8859-15, UTF-8, cp866, cp1251, cp1252, and KOI8-R are effectively equivalent, as the characters affected by htmlspecialchars() occupy the same positions in all of these charsets. --- This is misleading. (The paragraph was introduced by #49412.) Example: var_dump( htmlspecialchars( "\xe8", ENT_QUOTES, 'UTF-8' ) ) returns: PHP 5.2.1: string(1) "�" but in later versions: PHP 5.2.6: string(0) "" PHP 5.3.5: string(0) "" Test script: --------------- echo htmlspecialchars( "\xe8", ENT_QUOTES, 'UTF-8' ); Expected result: ---------------- I suggest removing the aforementioned paragraph from the manpage, and add a note under Changelog or Return Values, stating that, as of php 5.2.5 (judging from php.net/ChangeLog-5.php), the function can return an empty string if there are invalid byte sequences for the specified charset. -- Edit bug report at http://bugs.php.net/bug.php?id=54263&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54263&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54263&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54263&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54263&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54263&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54263&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54263&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54263&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54263&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54263&r=support Expected behavior: http://bugs.php.net/fix.php?id=54263&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54263&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54263&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54263&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54263&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54263&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54263&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54263&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54263&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54263&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54263&r=mysqlcfg

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