Edit report at http://bugs.php.net/bug.php?id=52213&edit=1
ID: 52213 Updated by: ras...@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