0

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

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

6 Comments

Now I get the following Warning: cannot yet handle MBCS in html_entity_decode()!
@Roland: Are you still using PHP 4? You should update/upgrade your PHP. See bugs.php.net/bug.php?id=25670
@Gumbo Yep, php 4 is install on the server
@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: What? That can’t be. Or are you using ISO 8859-1 now?
|
1

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');

Comments

0

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

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.