internal Decoder SniffEncoding()
{
Decoder decoder = null;
if (this.SniffPattern("<?xml"))
{
string version = this.SniffAttribute("version");
if (version != null)
{
string encoding = this.SniffAttribute("encoding");
if (encoding != null)
{
try
{
Encoding enc = Encoding.GetEncoding(encoding);
if (enc != null)
{
this.m_encoding = enc;
return enc.GetDecoder();
}
}
catch (ArgumentException)
{
// oh well then.
}
}
this.SniffTerminator(">");
}
}
if (decoder == null)
{
return this.SniffMeta();
}
return null;
}