#30020 [Bgs]: htmlentities error
| From: | derick@php.net | Date: | Wed, 08 Sep 2004 07:03:52 +0000 |
| Subject: | #30020 [Bgs]: htmlentities error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65911@lists.php.net to get a copy of this message | ||
ID: 30020
Updated by: derick@php.net
Reported By: xing at mac dot com
Status: Bogus
Bug Type: Strings related
Operating System: Linux
PHP Version: 4.3.9RC2
New Comment:
replace the é with é in my explanation, by browser used UTF8 to post
the message ;-)
Previous Comments:
------------------------------------------------------------------------
[2004-09-08 09:01:17] derick@php.net
This is not a bug at all, you're doing something wrong here ;-)
THe first part of your code is:
<?
$str = "Le Café< Café <";
$str = htmlentities($str,ENT_QUOTES,"UTF-8");
This will try to interpret the $str as an UTF-8 string and add
htmlentities for all utf-8 chars that it finds in here.
Because é< is not a valid combination as a multi-byte UTF8 character,
the é is simply skipped.
I don't know why the second é isn't stripped out though.
Anyway, your code is wrong, don't try to use an iso-8859-1 string as
UTF8.
------------------------------------------------------------------------
[2004-09-08 08:51:02] xing at mac dot com
gzipped code sent to derick@php.net.
------------------------------------------------------------------------
[2004-09-08 08:35:25] derick@php.net
ascii is 7 bit, and accented characters are not in the 7 bit part and
thus could I see them with a different charset, please send me the
script.
------------------------------------------------------------------------
[2004-09-08 08:29:14] xing at mac dot com
There should be no hidden UTF-8 characters in the string: all ascii
compliant including the french accented e.
I did however have an error in the code where extra "(" was added. Here
is the complete and correct code you can just copy-paste from any
browser.
------
<?
$str = "Le Café< Café <";
$str = html_entity_decode(htmlentities($str,ENT_QUOTES,"UTF-8"));
echo $str;
?>
------------------------------------------------------------------------
[2004-09-08 07:46:50] derick@php.net
Can you e-mail me the scripts (in a zip file or something)? I am afraid
the bugsystem doesn't handle UTF8 well.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30020
--
Edit this bug report at http://bugs.php.net/?id=30020&edit=1