#34105 [Fbk->Csd]: htmlentities(chr(198).chr(146),1,'utf8') returns Α
| From: | nospamplease at veganismus dot ch | Date: | Fri, 12 Aug 2005 22:24:14 +0000 |
| Subject: | #34105 [Fbk->Csd]: htmlentities(chr(198).chr(146),1,'utf8') returns Α | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83494@lists.php.net to get a copy of this message | ||
ID: 34105
User updated by: nospamplease at veganismus dot ch
Reported By: nospamplease at veganismus dot ch
-Status: Feedback
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: Windows NT 5.2 build 379
PHP Version: 5.0.4
New Comment:
so what would you need to know? i gave you a code to reproduce it,
information about what i expect and what i get.
i tested this on another linux system using 5.0.4 (Jun 23 2005
13:03:04) the character was not convertad at all (which is better than
converting it to something else). i guess it only converts ASCII
characters (<256).
i'm gonna keep this closed now since the problem is not so
important. but it sure is (was?) an error in the html translation
table.
PS: It's "be excellent to each other" not "be excellent to them"
Previous Comments:
------------------------------------------------------------------------
[2005-08-12 23:24:28] sniper@php.net
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..
------------------------------------------------------------------------
[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