Re: htmlentities is incomplete: does not cover rsquo etc
| From: | Jan G.B. | Date: | Fri, 13 Mar 2009 17:27:54 +0000 |
| Subject: | Re: htmlentities is incomplete: does not cover rsquo etc | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290006@lists.php.net to get a copy of this message | ||
2009/3/13 Heddon's Gate Hotel <hotel@heddonsgate.co.uk>:
> The string function htmlentities seems to have very incomplete coverage of
> the HTML entities listed in the HTML 4 spec. For example, it does not know
> about rsquo, lsquo, rdquo, ldquo, etc. This is confirmed by looking at the
> output of get_html_translation_table, which does not list these entities.
>
> My impression is that it covers those HTML entities that are in ISO-8859-1,
> but not the others. Is this deliberate? If so, the Manual is misleading
> because it suggests that all HTML entities are covered. Otherwise, is this a
> bug?
>
Well, If you specify the input charset you'll have no problem at all. ;)
<?= htmlentities('string with UTF-8: ±ªÐº×N>>µ»n“¢µ€jæ',
ENT_QUOTES,
'UTF-8'); ?>
Latin1 AKA ISO-8859-1 doesn't have ldquo nor bdquo nor ndash and alike.
Regards,