Page 1 of 1

Unicode string to show in javascript alert()

Posted: Mon Apr 28, 2008 5:12 pm
by cohq82
I am writing a script to parse a unicode string to show on the screen in alert(). However, I don't know of a way to convert something like

$text = "T& #236;m ki& #7871;m n& #226;ng cao";

into a unicode string within HTML so alert() can show the right thing.

I use the function below but no luck.

Code: Select all

 
echo "<html><head>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head><body>";
echo mb_convert_encoding(html_entity_decode("T& #236;m ki& #7871;m n& #226;ng cao"), 'UTF-8');exit;
 
The mbstring extension is enabled by the way!

What can I do? Thanks