views:

41

answers:

3

I have the following line of text that I need to display

<ul><li>Complementary to cleansing with HY-ÖL®<li>Especially for irritated and sensitive skin<li>Noticeably calms and relaxes the skin</ul>

if I do the following

html_entity_decode('<ul><li>Complementary to cleansing with HY-ÖL®<li>Especially for irritated and sensitive skin<li>Noticeably calms and relaxes the skin</ul>');

the text comes ou the following way

* Complementary to cleansing with HY-�L�
* Especially for irritated and sensitive skin
* Noticeably calms and relaxes the skin

the problem is that it tries to encode the HY-ÖL® aswell and then it ends up like this HY-�L�

Confused here, please help

+1  A: 

Check your header-encoding to see that you're sending the right encoding.

Example for utf-8 encoding.

header('Content-Type: text/html; charset=utf-8');

xintron
This solved my problem
Roland
A: 

Try setting the page's encoding type to utf-8 eg:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Sarfraz
+4  A: 

You need to specify the character encoding you want the output in:

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

Otherwise html_entity_decode assumes ISO 8859-1 as default.

Gumbo
Now I get the following Warning: cannot yet handle MBCS in html_entity_decode()!
Roland
@Roland: Are you still using PHP 4? You should update/upgrade your PHP. See http://bugs.php.net/bug.php?id=25670
Gumbo
@Gumbo Yep, php 4 is install on the server
Roland
@Gumbo Thanx for this solution unfortunately I'm not the server admin, so no way for me to upgrade. xintron's solution solved my problem at the end. 1up for you
Roland
@Roland: What? That can’t be. Or are you using ISO 8859-1 now?
Gumbo
@Gumbo - I did not manage to get rid of the error, encoding is ASCii, html_entity_decode did not recognise ASCii
Roland