How to get XML declaration header? Android
<p>I'm writing a rss reader app for android and now i need to know what is the encoding of xml before i start parsing it (windows-1251 or utf-8). This is described in xml declaration header i.e. <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>. How can i get this header before parsing? I use android.sax implementation of sax parser and pass encoding as string parameter to InputStreamReader.
   I found a related question:
<a href="http://stackoverflow.com/questions/9931024/sax-parser-doesnt-recognize-windows-1255-encoding">SAX Parser doesn&#39;t recognize windows-1255 encoding</a> - but the solution there is to convert cp-1251 to utf-8, which is too cumbersome and demanding on resources. I think there must be better solution, as i only need to know encoding value from header <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>. But i can't manage to get this header from xml, parser starts from <code>&lt;rss&gt;</code> tag. How should i get it? </p>
