private Encoding GetTextEncoder()
{
string str = null;
if (this.responseHeaders.TryGetValue("CONTENT-TYPE", out str))
{
int index = str.IndexOf("charset", StringComparison.OrdinalIgnoreCase);
if (index > -1)
{
int num2 = str.IndexOf('=', index);
if (num2 > -1)
{
char[] trimChars = new char[] { '\'', '"' };
string name = str.Substring(num2 + 1).Trim().Trim(trimChars).Trim();
int length = name.IndexOf(';');
if (length > -1)
{
name = name.Substring(0, length);
}
try
{
return Encoding.GetEncoding(name);
}
catch (Exception)
{
Debug.Log("Unsupported encoding: '" + name + "'");
}
}
}
}
return Encoding.UTF8;
}