#34105 [Opn->Fbk]: htmlentities(chr(198).chr(146),1,'utf8') returns Α
| From: | sniper@php.net | Date: | Fri, 12 Aug 2005 20:40:43 +0000 |
| Subject: | #34105 [Opn->Fbk]: htmlentities(chr(198).chr(146),1,'utf8') returns Α | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83480@lists.php.net to get a copy of this message | ||
ID: 34105
Updated by: sniper@php.net
Reported By: nospamplease at veganismus dot ch
-Status: Open
+Status: Feedback
Bug Type: Unknown/Other Function
Operating System: Windows NT 5.2 build 379
PHP Version: 5.0.4
New Comment:
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-08-12 18:28:06] nospamplease at veganismus dot ch
Description:
------------
i think ƒ (aka ƒ aka ƒ) is converted to a nonapplicable
character (Α) 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: ƒ<br>Expected result (source):
&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:
----------------
"ƒ" (or "ƒ")
Actual result:
--------------
"Α"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34105&edit=1