Unicode codes (ex &#x1100) display in Firefox, Chrome but not IE8

Very amateur coder here. Thinking of beginning to learn Korean and thought I could combine PHP programing as well.

See bottom of this page (in IE) for error: test

All browsers (Chrome, IE, Firefox) up to date on Vista x64 (tested on Windows 7 x32 as well) IE8 compatibility mode makes no difference.

Trying to programatically reproduce: http://www.novahapkido.com/MyImages/hangul.gif

Using the excellent reference here: http://www.kfunigraz.ac.at/~katzer/korean_hangul_unicode.html

The reason I need the character codes is the ‘math’ in the middle of that site, it will allow me to find the resulting Hangul by ‘adding’ the jamo.

The code in question is


        print "Still doesn't work in IE:"."\
";
        for ($i = 0; $i <= 18; $i++)
        {
            if ($i <10) $prefix = "&#x110";
            else $prefix = "&#x11";
            dechex($i);
            $add = $prefix.$i;
            print html_entity_decode($add, ENT_NOQUOTES,'UTF-8')."\
";
        }

I’ve also tried UTF8_encode before html_entity_decode, even ‘naked’ everything works but IE. headers and meta both set to utf8.

Most of my programing ideas are based on other languages so working with UTF8 has been a bit daunting for me. I have searched the site including re-reading the sitepoint guide to character encoding, also found http://www.ibm.com/developerworks/library/os-php-unicode/index.html but it is a bit over my head.

Any ideas? Further utf8 tips are welcome!

Hi eDRoaCH, welcome to SitePoint! :slight_smile:

Character references need to end with a semi-colon ( ; ), so if you add them to those ones that aren’t working they should work fine.

I.e. instead of
& # x 1110

make it
& # x 1110;

(I used spaces so that the code would render on screen.)

Your page is being served as utf-8, so no worries there. :slight_smile:

Yes, I guess it’s random like that. On this day, Firefox and Safari were your friends. Opera also was not very happy with you, though!

Glad that helped, anyway. :slight_smile:

Thanks for that, I knew it had to be something simple. Strange though, in the past I’ve usually found it is IE that is forgiving of mistakes and Firefox, etc being more merciless.