Re: ENT_ALL or similar option for htmlspecialchars[_decode]?
| From: | Yasuo Ohgaki | Date: | Thu, 27 Jun 2013 07:03:21 +0000 |
| Subject: | Re: ENT_ALL or similar option for htmlspecialchars[_decode]? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67919@lists.php.net to get a copy of this message | ||
2013/6/27 Kris Craig <kris.craig@gmail.com>
> I just noticed that htmlspecialchars_decode doesn't convert entities like
> 
 and 
.
>
I think htmlspecialchars_decode() only decodes
ext/standard/html_tables.h
static const entity_stage3_row stage3_table_be_apos_00000[] = {
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"quot", 4} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {"amp", 3} } }, {0, {
{"apos", 4} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL,
0} } },
{0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, { {NULL, 0} } }, {0, {
{NULL, 0} } },
{0, { {"lt", 2} } }, {0, { {NULL, 0} } }, {0, { {"gt", 2} } }, {0, { {NULL,
0} } },
};
IIRC
I may be wrong.
> Is there a bitmask I'm missing or are those simply not
> supported right now? If the latter, any thoughts on adding something along
> the lines of ENT_ALL to convert all valid entities from/to their respective
> characters?
>
What you are looking for is html_entity_decode(), I think.
$ php -n -r 'var_dump(html_entity_decode(" ="));'
string(2) "
="
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net