Hot answers tagged c#
You're treating the response as a UTF-8 encoded string. That's bound to fail with binary data like GZip. A quick fix is to use Encoding.GetEncoding("iso-8859-1") instead of UTF8 in StringToByteArray, and also pass this encoding to the StreamReader constructor in FetchURL. That encoding maps bytes to codepoints one-to-one; see this answer on Stack Overflow. ...
Only top voted, non community-wiki answers of a minimum length are eligible