UTF-8 Encoded html in Firefox?

Community Forums/General Help/UTF-8 Encoded html in Firefox?

Gabriel(Posted 2009) [#1]
I'm trying to get Firefox to correctly display my non-iso characters. I was using this at the beginning of my document

<?xml version="1.0" encoding="UTF-8"?>


and it works great, but it clashes with PHP's short tags and I don't particularly want to disable short tags, even if it's possible on a shared server.

So I tried the meta tag approach:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">


but that doesn't work. So I tried using PHP's header function instead:

header('Content-type:text/html; charset=utf-8');


And that doesn't work either.

So I'm struggling to find something which I can replace my old markup with in order to make things work across browsers. I have no idea whether these non-working alternatives work on IE or not. Probably. They didn't work on Firefox, so I just moved on to the next one. I need something to set the UTF-8 encoding in all browsers.


Gabriel(Posted 2009) [#2]
Well I tried it any number of different ways but the only way I could get it to behave without disabling short tags was to echo the <?xml tag from php. It feels like a bit of a dirty hack, but Dreamweaver still recognizes it as a UTF-8 encoded file, Firefox reads it as UTF-8 and php doesn't have a conniption trying to parse things which are none of it's business.


ziggy(Posted 2009) [#3]
Just a very stupid question, are you sure Dreamweaver is writing the proper byteorder chars, and that the server understands them? otherwise, you can try not writing them on the file, but then I think you'll have to check the endianess of the server.


Gabriel(Posted 2009) [#4]
Well yeah, I'm pretty sure Dreamweaver was writing correctly and sure the server understands. If the pages are considered XML by DW, they work fine. I checked and Dreamweaver understood that I wanted the problem page to be Western ISO because I wasn't including that <?xml line. None of the alternatives seemed to be sufficient for Dreamweaver to get the idea of what I wanted. It's a page made from a template, so changing the encoding method is prevented.

So I guess for whatever reason, Dreamweaver doesn't know that you want an XML page unless you put that <?xml line in there. Echo'ing it with PHP seems to suffice, thankfully.