internal static string GetCharset(WebHeaderCollection responseHeaders)
{
var contentType = responseHeaders[HttpResponseHeader.ContentType];
if (string.IsNullOrEmpty(contentType))
return null;
try {
return new ContentType(contentType).CharSet;
} catch (FormatException) {
return null;
}
}