• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
I'm so happy! And I wish to make this tiny ad happy too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic