Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

MultiLanguage - Char encoding in XML

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
The requirement is that the characters in czech is supposed to be read and with no manipulation it has to be printed to thrown to the browser.
I am using Jaxp, Crimson parser's document.parse method to parse the doc. "Document xmlDocument = DocBuilder.parse(xmlFile);" - xml file is a statc file containing the xml content in czech. The problem is that, immediately when I try to write the characters read to another file, the characters seem to be corrupted. In XML the encoding specified is ISO-8859-2(recommended/prescribed encoding type for Czech lang in w3c.org)
Question is how these spcl chars need to be handled..? It will be highly appreciable if someone can come up with any suggestion inluding if it is a limitation with Crimson or with any method to solve this.
Many Thanks
ak
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure what method you are using to write output. As a hint in the right direction, look at the class java.io.OutputStreamWriter, constructor:
OutputStreamWriter( OutputStream out, String encoding )
if you supply "ISO-8859-2" as the encoding parameter, you should get the correct characters.
Regards, Adam.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic