#34105 [NEW]: htmlentities(chr(198).chr(146),1,'utf8') returns Α

From: Date: Fri, 12 Aug 2005 16:28:07 +0000
Subject: #34105 [NEW]: htmlentities(chr(198).chr(146),1,'utf8') returns Α
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83464@lists.php.net to get a copy of this message
From: nospamplease at veganismus dot ch Operating system: Windows NT 5.2 build 379 PHP version: 5.0.4 PHP Bug Type: Unknown/Other Function Bug description: htmlentities(chr(198).chr(146),1,'utf8') returns &Alpha; Description: ------------ i think &fnof; (aka &#131; aka &#402;) is converted to a nonapplicable character (&Alpha;) when converting from UTF-8. This is similar to the bug #32063. Reproduce code: --------------- <? header('Content-Type: text/html; charset=utf8'); $chr = uft8_chr(402); echo 'UTF-8-Character: '.$chr; echo ' ('.ord($chr[0]).'/'.ord($chr[1]).')'; echo '<br>Actual result: '; $str = htmlentities($chr,1,'utf-8'); echo $str; echo '<br>Actual result (source): '; echo htmlspecialchars($str); echo '<br>Expected result: &fnof;<br>Expected result (source): &amp;fnof;'; function uft8_chr($num){ if($num<128)return chr($num); if($num<2048)return chr(($num>>6)+192).chr(($num&63)+128); if($num<65536)return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128); if($num<2097152)return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128) .chr(($num&63)+128); return ''; } ?> Expected result: ---------------- "&fnof;" (or "&#402;") Actual result: -------------- "&Alpha;" -- Edit bug report at http://bugs.php.net/?id=34105&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34105&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34105&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34105&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34105&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34105&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34105&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34105&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34105&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34105&r=support Expected behavior: http://bugs.php.net/fix.php?id=34105&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34105&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34105&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34105&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34105&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34105&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34105&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34105&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34105&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34105&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34105&r=mysqlcfg

« previous php.bugs (#83464) next »