XMLDOM encoding problem
I'm using XMLDOM to transform an xml file into a
static web page using xsl. When i don't use the dtd everything is ok but when i do, the transformation is done but the result is a page with the line <?xml version="1.0" encoding="UTF-16" ?> and that's all...
I never specified UTF-16 (i use ISO-8859-1)...
Where does that utf thing come from?! and how can i avoid it? :(
Have you tried specifying ISO-8859-1 ?
First line of XSL file should be (in your case):
<?xml version="1.0" encoding="ISO-8859-1"?>
yes sure i've specified ISO-8859-1 in xml, xsl and the dtd file too...no way!
Here are more details about the encoding in my project :
xml file : <?xml version="1.0" encoding="ISO-8859-1" ?>
xsl file : i specify the encoding inside the template, in the html header
the DTD file : <?xml version="1.0" encoding="ISO-8859-1" ?>
When i don't specify the DTD in my xml file, it works ok, but when i do it, i try either using browser or with my asp script to transform the xml :
I get this error :
Switch from current encoding to specified encoding not supported.
I'm really not expert in text file encodings, but it seems like specifying DTD with its encoding="ISO-8859-1" causes some conflict...
After searching the net for some info, i've read that the problem might come from the XMLDom object, has something to do with the "oXML.Load()" method...
here is what i've found on ms.com
AFAIK, UTF-8 is the default encoding type, which will be used whenever the encoding is not specified. Having never (so far) needed to use anything other than UTF-8, I am curious as to why exactly that you need to use that particular encoding type (?)
I use that encoding cause the language of the web site is french, which means some caractères like é è à ù î...etc
I thought that would probably be it. I can't located much information about foreign characters in XML on the web, and the MS XML4 SDK isn't very helpful, but from what I have been able to find, UTF-16 should be fine too. Can you try it?
Any joy? I came across this page, which might help:
Just to check, all three documents should have exactly the same first line:
(Any encoding info in the HTML header generated by the XSL only helps the browser/client, not the XML parser while it's processing)
<?xml version="1.0" encoding="ISO-8859-1" ?>
Also, what happens if you leave out the DTD?