Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with characters é,ã and º

 
VenuGopal Thati
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!