Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XML Parsing Base64 Content - Special Characters Umlaut etc

843834Mar 15 2005 — edited Mar 15 2005
Hello!

I am currently parsing an XML file which has it's content encoded in Base64. My application parses the XML file (from a provider) and pass on the content to a GUI where the user can change the value of the nodes and store the same back in a new XML (which is then to be sent back to the provider). The Application uses only "UTF-8" . I am currently using the Base64 class provided at http://iharder.net/base64

The problem I have is that the special characters like �, � etc, are being depicted as (?) i.e. unreadable. Only when I control the decoding process i.e.
String resoolt = new String (result.getBytes(), "UTF-8")
do I get the correct content, and the same can be posted on the GUI.

The application produces an XML file (The application in question is a translation app), which when re-opened in the application for retranslation has the same problem... it is shown with teh special characters with (?).

After a lot of debugging I found that the XML produced by the application does not need the forcing of content into UTF-8 using the code above, it is read automatically correctly (with all the content correct), but due to the coding I have done...
String resoolt = new String (result.getBytes(), "UTF-8")
the nodes are decoded with the earlier problem umlauts et al missing.

Now I could use a test to differntiate between the two cases XML from the provider or the XML which is produced by my own app, and doesn"t work on the Provider and treat them differently, but I don't want this solution since the XML which my app produces is not accepted as input at the providers.

So my query.. what is the best way to go about it now... I am quite stymied >(

Thanks!
Tim
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2005
Added on Mar 15 2005
2 comments
327 views