Hi all experts,

I have this issue: Basically I am trying to show a text in Unicode in a javascript dialog box (i.e to confirm with 'Yes' or 'No'). This text is in a string such as "Thư báo tin" which contains char references because I cannot store unicode in .php file. I want to parse this string to another string which will be echo on the screen. Before parsing, I want the string to be in Unicode format because if I parse it as -is, the display in my javascript dialog box will be shown exactly what you see here "Thư báo tin"

Is there a solution for this? My PHP Version 5.2.5

Thanks

    If the [man]mbstring[/man] extension is enabled, you could try something like:

    echo mb_convert_encoding(html_entity_decode($text), 'UTF-8');
    

      I created this simple script and I did saw the unicode display in the browser. However, what I want to have is unicode display in the code itself when I "View Code". The thing is javascript won't display unicode in message box.

      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;

      Can you help? Thanks

        Write a Reply...