Source map not in utf8 encoding

We are having a similar issues with source maps scraped by Sentry.

Sentry reports that our source file was not utf8.

However, it is valid utf8

  1. Uploading the map directly to Sentry with the API works fine. The problem only arises when it is scraped.

  2. Looking at the code that @benvinegar linked to, loading the file directly into a python repl and checking the contents, I see that the contents are indeed six.binary_type, and can be successfully decoded as utf8, so it’s unusual that the file is actually making it way into that code branch.

  3. Running iconv -f utf-8 against the file is successful.

Is it possible Sentry is incorrectly raising a utf8 error when the problem is something else? Maybe the file isn’t downloaded completely or something?