Page 1 of 1

CHARSET Issues.... htmlentities()

Posted: Tue Aug 02, 2005 6:39 pm
by jeffereylockyer
Here is the problem I am having. I am trying to take data that was placed in my database with unicode characters, such as é å ø etc.... The database I am dealing with is in unicode format. Here is the php code I am trying to test...

Code: Select all

<?php
$str = "A 'quote' is <b>bold</b> é";
echo $str;
$str2 = htmlentities($str, ENT_QUOTES, "UTF-8");
echo $str2;
?>
Here is what I get in return
A 'quote' is bold Ž
A 'quote' is <b>bold</b> Ž

This is the source of the html page produced by php
A 'quote' is <b>bold</b> Ž
A 'quote' is <b>bold</b> Ž

What I assume I should be getting is

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

It also does not seem to matter which encoding scheme I pass to htmlentities (UTF-8, ISO-8859-1, ISO-8859-15, etc...) they all return the same value as above. I am not sure if this is affected by something on the server side or the php method, or the browser ? I really hope someone can shed some light on this issue for me, thanks in advance.

Jeff.

Posted: Wed Aug 03, 2005 2:21 am
by anjanesh
Im getting :

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

in both FireFox 1.0.6 and IE 6.0 SP1