James Tauber

journeyman of some

blog > 2005 > 12 > 30 >

XML Declaration Required for UTF-8 AJAX

Jenni was adding some non-ASCII cards to her local Quisition instance and it wasn't working. The browser, Safari, was getting the wrong encoding.

Strangely, manually telling Safari the encoding didn't help. I suspected culprit might be AJAX as the problem was with content loaded asynchronously.

Sure enough, after being thrown off by a couple of red herrings, I found that the response to XMLHttpRequest, at least on Safari, requires an XML Declaration with encoding="utf-8" even though, according to the XML TR, it shouldn't.

Categories:
prev « quisition » next
ajax » next

Comments (2)

rakoth on May 26, 2006:

in your server-side script which feeds data to Safari, do this (PHP example here....):

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

Safari and some other browsers need to be told explicitly that its uft-8. Content-Type can be changed to meet your needs.

rapto on Nov. 15, 2006:

beware that ie6 might accept only UTF-8 in upper case

Add a Comment

Created: Dec. 30, 2005
Last Modified: Dec. 30, 2005
Author: jtauber