This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes problem with characters é,ã and º Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "problem with characters é,ã and º" Watch "problem with characters é,ã and º" New topic
Author

problem with characters é,ã and º

VenuGopal Thati
Greenhorn

Joined: Feb 05, 2010
Posts: 4
Hello,

I am facing a problem with characters é,ã and º in xml. when i parse the xml file with enocding as 'UTF-8' on linux machine, file is getting parsed and data saved in database by replacing above characters with ? . If I process the same file on windows i get the error saying "org.xml.sax.SAXParseException: Invalid byte 2 of 3-byte UTF-8 sequence." But i change the encoding to "ISO-8859-1" the file was parsed without any errors and data getting saved in db without replacing characters with ?.

é,ã and º characters are not in "UTF-8" character set ? or these characters belongs to "ISO-8859-1" character set?. I am hoping that above characters are not in UTF-8 list because I took the original file with special characters and created a new file as below

FileOutputStream fos = new FileOutputStream("C:\\test.xml");
Writer out = new OutputStreamWriter(fos, "UTF-8");
out.write(str);
out.close();

The generated file replaced the characters é,ã and º with é,ã and º. Why this is happening ?
Please help me out in finding the root cause. Thanks in advance.

Thanks.



 
 
subject: problem with characters é,ã and º