php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39891 htmlentities missing entity
Submitted: 2006-12-19 17:39 UTC Modified: 2006-12-21 06:31 UTC
From: jeff at dakusan dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.2.0 OS: Multiple (XP & RedHat)
Private report: No CVE-ID: None
 [2006-12-19 17:39 UTC] jeff at dakusan dot com
Description:
------------
htmlentities is missing the ? character as ’.

Reproduce code:
---------------
print htmlentities("?");

Expected result:
----------------
’

Actual result:
--------------
?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-20 18:35 UTC] shire@php.net
Hello, if you specify the encoding type UTF-8 this should work as expected, I don't believe right single quote is part of the default iso-8859-1 specification.

<?php
$char = html_entity_decode('&rsquo;', ENT_COMPAT, 'UTF-8');
echo $char;
echo htmlentities($char, ENT_COMPAT, 'UTF-8');
?>


 [2006-12-21 06:31 UTC] jeff at dakusan dot com
You are correct.  It is only part of the cp1252 "Windows specific charset for Western European." for php.
http://www.w3.org/TR/html4/sgml/entities.html states that it is part of the "Character entity references for symbols, mathematical symbols, and Greek letters" - [ISO10646].  Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 19:01:33 2025 UTC