views:

30

answers:

2

I need to convert a string like this:

A &#039;quote&#039; is <b>bold</b>

into:

A 'quote' is <b>bold</b>

html_entity_decode() did not work.

+1  A: 
mb_convert_encoding($string, "UTF-8", "HTML-ENTITIES");

You can replace "UTF-8" with whatever encoding you need (though depending on the encoding you choose, certain characters may not be representable).

Artefacto
+1  A: 

Make sure you use the right quote_style:

html_entity_decode('A &#039;quote&#039; is <b>bold</b>', ENT_QUOTES);

ENT_QUOTES Will convert both double and single quotes. (PHP Manual: html_entity_decode)

Robert Ros
That helps - thats exactly it - it worked fine after this! Thanks RObert!
tzmatt7447