• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

problem with characters é,ã and º

 
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.



 
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic