Identify Encoding of an XML document coming in as a stream
posted 10 years ago
I have an XML coming in a s a inputsource from which i get the characterstream and finally write that stream to a file using a "outputStream" [Note: I dont use FileWriter since it writes with default encoding.]and assuming the encoding as UTF-8.
Now this assumption of UTF-8 encoding has to be done away with and i need to identify the encoding specified in the XML document, so that i can write to the file using the same encoding.
Need some ideas to achive this, that is "How to get the encoding of an XML document coming in as a Characterstream".
Any help/pointers/ideas are appreciated and welcome..