php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #40035 get_html_translation_table() ignores locale + [RFE] option to override charset
Submitted: 2007-01-05 17:40 UTC Modified: 2013-08-02 01:31 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: leonard-php-bugs at ottolander dot nl Assigned: yohgaki (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.0 OS: irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: leonard-php-bugs at ottolander dot nl
New email:
PHP Version: OS:

 

 [2007-01-05 17:40 UTC] leonard-php-bugs at ottolander dot nl
Description:
------------
get_html_translation_table() will only return the translation table for the default character set (iso-8859-1).

Please add a third option (charset) to get_html_translation_table() to select the translation table for the character sets that are supported by html_entities().

(compare bug 18072)

(Actually only tested against php-4.3.9 (CentOS 4) and php-4.3.2 (CentOS 3), but as there is no change in the docs I find it highly unlikely this option has been added in the mean time. If it has I apologize.)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-05 19:09 UTC] leonard-php-bugs at ottolander dot nl
Looking at the source of php-5.2.0 I get the impression get_html_translation_table() actually ignores any locale settings:

PHP_FUNCTION(get_html_translation_table):
	enum entity_charset charset = determine_charset(NULL TSRMLS_CC);

static enum entity_charset determine_charset(char *charset_hint TSRMLS_DC):
	/* Guarantee default behaviour for backwards compatibility */
	if (charset_hint == NULL)
		return cs_8859_1;

If I am reading the above correctly determine_charset() will always return cs_8859_1 to get_html_translation_table() as the latter passes NULL as the charset_hint.

So it's not only not possible to override the charset when returning the translation table (which might be useful when handling data that does not use the same charset as the system), it seems the function totally ignores the system locale.
 [2013-08-02 01:31 UTC] yohgaki@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: yohgaki
 [2013-08-02 01:31 UTC] yohgaki@php.net
You may specify encoding with current get_html_translation_table()

http://php.net/manual/en/function.get-html-translation-table.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 16:01:29 2025 UTC