<?xml version="1.0" encoding="UTF-16"?>
<note>
<from>Jani</from>
<to>ALOK</to>
<message>AshuTosh</message>
</note>
I have the XML parser which supports UTF-8 encoding only else it gives SAX parser exception. How can i convert the UTF-16 to UTF-8?
In that case its not a XML parser that your are using, see section 2.2 of the xml specification:
Java xml parsers usually receive their input wrapped in an InputSource object. This can be constructed with a
Readerparameter that does the character decoding for the given charset.For the “utf-16” charset the stream should start with a byte order mark, if that is not the case use either “utf-16le” or “utf-16be”.