XML Encoding using JAVA
1 posts in topic
Flat View  Flat View

Posted By:   info_world
Posted On:   Tuesday, December 4, 2007 04:21 AM

Hi Friends,

I have few xml files in which declared encoding is different from actual encoding [Encoding type in which the xml file is saved]. I now need to parse such files and get the output for declared and actual encoding types using java.

Please let me know if its possible and if YES, how??

Any help is highly appreciated.

Re: XML Encoding using JAVA

Posted By:   Robert_Lybarger  
Posted On:   Tuesday, December 4, 2007 09:02 AM

There is no way, in a general and arbitrary sense, for a program to "know" what the "real" encoding of file is -- a file is just ones and zeros to it, and any representation is just as valid in a case like this. If *you* know what some of the characters are supposed to be, you could create a Reader of some variety using one of the constructor forms that also takes a Charset instance. You could try a few different character sets and see which one gives the right answer. If that doesn't really work, you need to find the author of the file and smack them around a little bit.
About | Sitemap | Contact