php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43777 htmlentities converts specialchars wrong
Submitted: 2008-01-07 15:39 UTC Modified: 2008-03-26 12:36 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: klooss at serviceconnect dot biz Assigned:
Status: No Feedback Package: Strings related
PHP Version: 4.4.8 OS: Win32 / Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: klooss at serviceconnect dot biz
New email:
PHP Version: OS:

 

 [2008-01-07 15:39 UTC] 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 &#180;
PHP Convert it in: &amp;#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
? ' " `
&amp;#180; ' &quot; `
**/

Expected result:
----------------
? ' " `
&#180; ' &quot; `


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-07 16:13 UTC] klooss at serviceconnect dot biz
You can fix this bug with this code example

$str='dwadwadawd&amp;#180;dwadawd';
print(preg_replace("/&amp;#(.*?);/","&#$1;",$str));

it is not so good but it's work...
 [2008-01-07 23:03 UTC] johannes@php.net
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.
 [2008-01-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC