php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49407 get_html_translation_table(): it doesn't output table for htmlentities in utf-8
Submitted: 2009-08-29 18:33 UTC Modified: 2010-10-12 04:51 UTC
From: thomas at landauer dot at Assigned: cataphract (profile)
Status: Closed Package: Strings related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2009-08-29 18:33 UTC] thomas at landauer dot at
Description:
------------
get_html_translation_table(HTML_ENTITIES) lists the tranlation table used by htmlentities *when no charset parameter is given*.

htmlentities($string, ENT_COMPAT, 'utf-8') encodes more characters than get_html_translation_table(HTML_ENTITIES) contains!!

So I suggest either:
*) Add a charset parameter to get_html_translation_table() - corresponding to htmlentities()
Or
*) Correct the documentation. E.g.: get_html_translation_table() will return the translation table that is used internally for htmlspecialchars() and htmlentities() when no charset parameter is given. Note: If htmlentities() is called with a charset parameter, it converts more characters than get_html_translation_table() shows. Currently, there is no way to display the translation table which is used in that case.

Reproduce code:
---------------
htmlentities('∫', ENT_COMPAT, 'utf-8'); // returns ∫

print_r(get_html_translation_table(HTML_ENTITIES)); // ∫ is not listed



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-30 19:32 UTC] jani@php.net
There is no such OS called "All".
 [2009-11-13 22:38 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2009-11-13 22:38 UTC] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=290717
Log: Works with default charset (bug #49407)
 [2010-10-11 02:19 UTC] cataphract@php.net
-Status: Closed +Status: Re-Opened -Assigned To: +Assigned To: cataphract
 [2010-10-11 02:21 UTC] cataphract@php.net
-Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: Strings related
 [2010-10-12 04:51 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=304340
Log: - Added a 3rd parameter to get_html_translation_table. It now takes a charset
  hint, like htmlentities et al.
- Fixed bug #49407 (get_html_translation_table doesn't handle UTF-8).
- Fixed bug #25927 (get_html_translation_table calls the ' ' instead of
  ').
- Fixed tests for get_html_translation_table and unified the Windows and
  non-Windows versions of the tests.
 [2010-10-12 04:51 UTC] cataphract@php.net
-Status: Re-Opened +Status: Closed
 [2010-10-12 04:51 UTC] cataphract@php.net
Fixed for PHP 5.3 and trunk.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC