[Javascript] Microsoft.XMLHTTP and character encoding.

Håkan Magnusson hakan at backbase.com
Tue Feb 3 07:51:06 CST 2004


Greetings,

We are using Microsoft XMLHTTP to load XML-files (XMLHttpRequest in 
Mozilla) and I am running into a problem. Internet Explorer/XMLHTTP 
always gives me ? (character code 65533, heh) instead of latin 
characters with diaeresis (ö, ï and so on) or acutes/rings.

We set both the "parent" HTML document (through meta-tag) and the 
XML-document (in the <?xml ..?>-tag) encoding to iso-8859-1, but this 
makes no difference  when we load the file.

If I simply view the xml-file through Internet Explorer or Mozilla (not 
loading it through my javascript, just typing the URL in the address 
bar) everything looks just fine, correct encoding (it doesn't look good 
when I change the encoding, so this actually works) and no garbage.

What's the deal, is there an automatic conversion somewhere between 
loading the XML-file and outputting it? On a sidenote, entities that I 
declare in the XML-file work when I just view the file, but these are 
lost together with my special characters when the file has been through 
the XMLHTTP-object.

Any suggestions?

Hakan



More information about the Javascript mailing list