SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    May 2000
    Location
    Casablanca, Morocco
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried specifying ISO-8859-1 ?

    First line of XSL file should be (in your case):
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>

    M@rco

  3. #3
    SitePoint Member
    Join Date
    May 2000
    Location
    Casablanca, Morocco
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx M@rco,
    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 :
    <%...
    file.Write(xmlDocument.transformNode(xslDocument))
    ...%>

    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


  4. #4
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 (?)


    M@rco

  5. #5
    SitePoint Member
    Join Date
    May 2000
    Location
    Casablanca, Morocco
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use that encoding cause the language of the web site is french, which means some caractères like é è à ù î...etc

  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?


    M@rco

  7. #7
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any joy? I came across this page, which might help:
    http://www.czyborra.com/utf/

    Just to check, all three documents should have exactly the same first line:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    (Any encoding info in the HTML header generated by the XSL only helps the browser/client, not the XML parser while it's processing)

    Also, what happens if you leave out the DTD?


    M@rco


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •