0

I have some C# code communicating with Analytics API v2.4. This has been working for almost five years, but suddenly Analytics is returning malformed XML, starting with character 0x1F.

Method XmlReader.MoveToContent() throws System.Xml.XmlException with message:

' ', hexadecimal value 0x1F, is an invalid character. Line 1, position 1.

This was first noticed on 8 Aug 14:30 UTC. Four hours earlier this was not a problem.

I realize this is more a bug report than a question, still:

  • Has anyone else noticed this?
  • What do you do against this? In C# you can work around this by setting ReaderSettings.CheckCharacters to false but I don't know what other side effects this may cause.

Thanks!

Zweitze
  • 28
  • 4

1 Answers1

0

I'm guessing that the response is being gzip compressed (gzip's header starts with 1f 8b) and you'll have to decompress it now.

I'm not sure what changed, your code, your libraries or the analytics API.

Sorry I'm not a C# expert and can't help you with the code.

see https://en.wikipedia.org/wiki/Gzip#File_format

Josh
  • 376
  • 1
  • 5
  • This was the hint in the right direction. My code added a header requesting for GZIP but could not handle GZIPped responses. This was never a problem because Analytics API 2.4 ignored this encoding request for many years. Apparently this changed recently. One would not expect that Google ignores such requests but it's been noticed before - see [this comment](https://stackoverflow.com/questions/2815721/net-is-it-possible-to-get-httpwebrequest-to-automatically-decompress-gzipd-re#comment31685565_2815823) – Zweitze Aug 14 '17 at 08:32