• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

XML Parsing -> Character encoding and Euro sign

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to parse an XML with a Euro sign (€) in it. I am encountering the following scenarios based on the encoding type being used:
1. UTF-8 Encoding
Error returned: Error : javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.

2. ISO-8859-1 Encoding
Euro symbol is visible as "?"

3. ISO-8859-15 Encoding
Euro symbol is visible as "?"

According to the information known, encoding ISO-8859-15 supports the Euro symbol .
Why is it that a question mark is being displayed?

I am using WSAD 5.1 as the IDE.
Are there any other seetings I need to consider for parsing XML with specific encodings like JVM character encoding settings or WSAD specific some setting?

Any help in this regard will be highly appreciated.

Thanks & regards,
Anup

 
Sheriff
Posts: 22701
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you mean with "is visible" as "is printed using System.out", then that's your problem - the console simply cannot handle it. Try showing it using JOptionPane.showMessageDialog instead.
 
Anup Bansal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We tried your suggetion but this does not work.
We tried writing the value to a file and still the Euro sign is displayed as ?.
Also when trying to insert the value into the database that supports cp1252 character set, the value displayed is a ?

What other encoding setting do we have to implement to make this visible.

Kindly help!!
 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

I've had some problems with this and it was due to the JVM's default charset.

The link here gives you information on checking what the default currently is:
http://www.rgagnon.com/javadetails/java-0505.html

Sean
 
He baked a muffin that stole my car! And this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic