Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't this decode to the html entity?

Try it yourself:

echo(html_entity_decode("…"));

It echos … instead of as it should.

Why won't this decode and how can I make it do so?

like image 577
Cyclone Avatar asked May 06 '11 00:05

Cyclone


1 Answers

Because the default ISO-8859-1 target character set does not contain the "…" character. You'll have to explicitly target UTF-8:

html_entity_decode('…', ENT_QUOTES, 'UTF-8')

Note that this changed in PHP 5.3.3 where UTF-8 became the default.

like image 154
deceze Avatar answered Oct 04 '22 01:10

deceze