Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Encoding UTF-8 vs iso-8859-1

Encoding UTF-8 vs iso-8859-1

Scheduled Pinned Locked Moved XML / XSL
helpxmlvisual-studio
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hariharan2105
    wrote on last edited by
    #1

    Hi, I had created an XML file with Unicode (encoding UTF-8) using Word 2007; the problem is when I try to view it in IE through an XSL result in the following error: An invalid character was found in text content... I changed the encoding of XML file to “ISO-8859-1” – able to view in IE but the characters get messed. Please Help. Hariharan C

    L E G 3 Replies Last reply
    0
    • H Hariharan2105

      Hi, I had created an XML file with Unicode (encoding UTF-8) using Word 2007; the problem is when I try to view it in IE through an XSL result in the following error: An invalid character was found in text content... I changed the encoding of XML file to “ISO-8859-1” – able to view in IE but the characters get messed. Please Help. Hariharan C

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Hariharan2105 wrote:

      I changed the encoding of XML file to “ISO-8859-1”

      ummm.... how?

      1 Reply Last reply
      0
      • H Hariharan2105

        Hi, I had created an XML file with Unicode (encoding UTF-8) using Word 2007; the problem is when I try to view it in IE through an XSL result in the following error: An invalid character was found in text content... I changed the encoding of XML file to “ISO-8859-1” – able to view in IE but the characters get messed. Please Help. Hariharan C

        E Offline
        E Offline
        Erik Molenaar
        wrote on last edited by
        #3

        Hi, did you try to set the output of your sxl file to utf-8 or iso-8859-1? example:

        <xsl:output method="xml" encoding="iso-8859-1" indent="yes" />

        otherwise, some more information might be needed to know where the encoding gets messed up.

        H 1 Reply Last reply
        0
        • H Hariharan2105

          Hi, I had created an XML file with Unicode (encoding UTF-8) using Word 2007; the problem is when I try to view it in IE through an XSL result in the following error: An invalid character was found in text content... I changed the encoding of XML file to “ISO-8859-1” – able to view in IE but the characters get messed. Please Help. Hariharan C

          G Offline
          G Offline
          George L Jackson
          wrote on last edited by
          #4

          Sometimes when you save a Unicode document, it places a couple of extra bytes at the beginning of the XML file. I usually delete those bytes, and everything seems to work after that.

          "We make a living by what we get, we make a life by what we give." --Winston Churchill

          1 Reply Last reply
          0
          • E Erik Molenaar

            Hi, did you try to set the output of your sxl file to utf-8 or iso-8859-1? example:

            <xsl:output method="xml" encoding="iso-8859-1" indent="yes" />

            otherwise, some more information might be needed to know where the encoding gets messed up.

            H Offline
            H Offline
            Hariharan2105
            wrote on last edited by
            #5

            Hi, I tried the following in XML And the following in XSD thanks,. Hariharan C.

            E 1 Reply Last reply
            0
            • H Hariharan2105

              Hi, I tried the following in XML And the following in XSD thanks,. Hariharan C.

              E Offline
              E Offline
              Erik Molenaar
              wrote on last edited by
              #6

              here is a dummy example I made to show the principle. neither dtd nor schema is provided and the xsl is connected in the xml to allow you to open the xml in ie and see the resulting (minimalistic) web page. rem: the location of my xsl file is hard coded in C:\Temp\ both files are saved on disk in utf-8 txt.xml:

              <?xml version="1.0" encoding="UTF-8"?&ft;
              <?xml-stylesheet type="text/xsl" href="C:\Temp\dummy.xsl"?>
              <bla>üöä</bla>

              dummy.xsl:

              <?xml version="1.0" encoding="UTF-8"?>
              <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
              <xsl:output method="xml" encoding="iso-8859-1" indent="yes" omit-xml-declaration="yes" media-type="text/html"/>
              <xsl:template match="bla">
              <html>
              <body>
              <xsl:value-of select="."/>
              </body>
              </html>
              </xsl:template>
              </xsl:stylesheet>

              hope this helps Erik

              H 1 Reply Last reply
              0
              • E Erik Molenaar

                here is a dummy example I made to show the principle. neither dtd nor schema is provided and the xsl is connected in the xml to allow you to open the xml in ie and see the resulting (minimalistic) web page. rem: the location of my xsl file is hard coded in C:\Temp\ both files are saved on disk in utf-8 txt.xml:

                <?xml version="1.0" encoding="UTF-8"?&ft;
                <?xml-stylesheet type="text/xsl" href="C:\Temp\dummy.xsl"?>
                <bla>üöä</bla>

                dummy.xsl:

                <?xml version="1.0" encoding="UTF-8"?>
                <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                <xsl:output method="xml" encoding="iso-8859-1" indent="yes" omit-xml-declaration="yes" media-type="text/html"/>
                <xsl:template match="bla">
                <html>
                <body>
                <xsl:value-of select="."/>
                </body>
                </html>
                </xsl:template>
                </xsl:stylesheet>

                hope this helps Erik

                H Offline
                H Offline
                Hariharan2105
                wrote on last edited by
                #7

                Thanks Erik, I tried this too, resulting two junk characters instead of Unicode character. Do I need to install any fonts for this? Regards, Hariharan C.

                E 1 Reply Last reply
                0
                • H Hariharan2105

                  Thanks Erik, I tried this too, resulting two junk characters instead of Unicode character. Do I need to install any fonts for this? Regards, Hariharan C.

                  E Offline
                  E Offline
                  Erik Molenaar
                  wrote on last edited by
                  #8

                  you have to take care that the files saved on disk are saved in utf-8 format and not in ansi (most text editors will allow you to change) Erik

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups