#34105 [Opn->Fbk]: htmlentities(chr(198).chr(146),1,'utf8') returns Α
| From: | sniper@php.net | Date: | Fri, 12 Aug 2005 21:24:29 +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-83485@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:
I could ask again, but as you're obviously not giving the information
we need, I'll simply bogus this next..
Please read the document about "How to report a bug" couple of times..
Previous Comments:
------------------------------------------------------------------------
[2005-08-12 22:55:46] nospamplease at veganismus dot ch
i also testet it on my personal computer (PHP/5.0.2 on Mandrake 10) and
the actual result is " " which is just as strange. the same goes
for html_entity_decode()!
other characters that are not convertet as expected:
Ɛ (Ɛ)
ϒ (ϒ)
ϖ (ϖ)
also characters with a very high ordinal number are not convertet at
all. i'd expect "Ẍ" (X with diaeresis) to be convertet to
Ẍ
then i testet it on PHP/4.4.0 (RedHat Linux) and the result was
correct!
------------------------------------------------------------------------
[2005-08-12 22:40:42] sniper@php.net
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.
------------------------------------------------------------------------
[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