#43777 [Opn->Fbk]: htmlentities converts specialchars wrong
| From: | johannes@php.net | Date: | Mon, 07 Jan 2008 23:03:12 +0000 |
| Subject: | #43777 [Opn->Fbk]: htmlentities converts specialchars wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121120@lists.php.net to get a copy of this message | ||
ID: 43777
Updated by: johannes@php.net
Reported By: klooss at serviceconnect dot biz
-Status: Open
+Status: Feedback
Bug Type: Unknown/Other Function
Operating System: Win32 / Linux
PHP Version: 4.4.8
New Comment:
The ´ character is not part of iso-8859-15, but for instance iso-8859-1
please check your encoding.
See http://www.fileformat.info/info/unicode/char/00b4/index.htm
and
http://www.fileformat.info/info/unicode/char/00b4/charset_support.htm
If it still goes wrong please give the exact byte values used by your
encoding.
Previous Comments:
------------------------------------------------------------------------
[2008-01-07 16:13:22] klooss at serviceconnect dot biz
You can fix this bug with this code example
$str='dwadwadawd´dwadawd';
print(preg_replace("/&#(.*?);/","&#$1;",$str));
it is not so good but it's work...
------------------------------------------------------------------------
[2008-01-07 15:39:44] klooss at serviceconnect dot biz
Description:
------------
I have build an simple function to convert any string's
here the src:
function htmlconverter($str) {
return htmlentities($str,ENT_QUOTES,'ISO-8859-15');
}
echo ("´ ' \" `");
echo "\n";
echo htmlconverter("´ ' \" `");
/** Output
´ ' " `
´ ' " `
**/
PHP Converted the Simbol >> ´ << wrong.
as unicode in HTML ´
PHP Convert it in: &#180;
I found the problem on "Debian Etch amd64 - php5.2.4-2", "Suse
php4.3.4" and "Win32 php5.2.3"
can anyone help my :) pls :)
thanks
Mathis Klooß (Germany)
Reproduce code:
---------------
function htmlconverter($str) {
return htmlentities($str,ENT_QUOTES,'ISO-8859-15');
}
echo ("´ ' \" `");
echo "\n";
echo htmlconverter("´ ' \" `");
/** Output
´ ' " `
&#180; ' " `
**/
Expected result:
----------------
´ ' " `
´ ' " `
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43777&edit=1