Bug #52213 [Opn->Bgs]: htmlspecialchars() encodes & and — in a wrong way
| From: | rasmus@php.net | Date: | Wed, 30 Jun 2010 15:57:50 +0000 |
| Subject: | Bug #52213 [Opn->Bgs]: htmlspecialchars() encodes & and — in a wrong way | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151990@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52213&edit=1
ID: 52213
Updated by: rasmus@php.net
Reported by: tomas at matfyz dot cz
Summary: htmlspecialchars() encodes & and — in a
wrong way
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: Linux niobe 2.6.25-gentoo-r8 #1
PHP Version: 5.2.13
New Comment:
That's what the double-encode parameter is for. Set it to false and it
won't
double-encode.
Previous Comments:
------------------------------------------------------------------------
[2010-06-30 17:54:45] tomas at matfyz dot cz
Description:
------------
The function htmlspecialchars() encodes the & character even if it is
part of some html entity like & or — .
The workaround is also difficult because the function doesn't allow to
disable replacing of the & symbol (I believe it should).
PHP version
Test script:
---------------
echo htmlspecialchars("&");
echo htmlspecialchars("—");
Expected result:
----------------
&
—
Actual result:
--------------
&
—
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52213&edit=1