Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML file parsed with encoding "ISO-8859-1" but not with "UTF-8"

 
Ravikumar Arunachalam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using xerces parser. I could not parse an XML file ( contains some special characters like � ) with encoding "UTF-8" but when i changed it to "ISO-8859-1", its getting parsed.
"UTF-8" encoding is the default encoding type. Also i am under the impression that this encoding will support all the character sets.

Can anyone tell me why this is not getting parsed?
 
Ravikumar Arunachalam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to add some examples to this.

The xml file working with ISO-8859-1.
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<from>Ravi</from>
<to>Kumar</to>
<message>Norwegian: ���. French: ���</message>
<body>Norwegian: ���. French: ���</body>
</note>

XML file not working with UTF-8 encoding
<?xml version="1.0" encoding="UTF-8"?>
<note>
<from>Ravi</from>
<to>Kumar</to>
<message>Norwegian: ���. French: ���</message>
<body>Norwegian: ���. French: ���</body>
</note>

So I want to know whether this ISO-8859-1 encoding covers all the character sets available. Can I use this as the default encoding for the XML files used for my application.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic