I was using requests to get some json form a url. I noticed at the start it had a weird unicode character. The start of the response text was u'\ufeff[{"Hos... (the message was sent with content-type of text/javascript; charset=utf-8)
After looking into it a bit, it looks like it was a BOM mark. Looking for solutions I came across this post which suggests decoding the string, which would work fine using urllib2 as it gives back the byte string. But in requests the response objects text attribute is already decoded with the BOM mark included.
I was wondering if this was something that could be addressed automatically? Or maybe it might end up biting people who expected to see that mark in the response text?
I was using
requeststo get some json form a url. I noticed at the start it had a weird unicode character. The start of the response text wasu'\ufeff[{"Hos...(the message was sent with content-type oftext/javascript; charset=utf-8)After looking into it a bit, it looks like it was a BOM mark. Looking for solutions I came across this post which suggests decoding the string, which would work fine using
urllib2as it gives back the byte string. But inrequeststhe response objectstextattribute is already decoded with the BOM mark included.I was wondering if this was something that could be addressed automatically? Or maybe it might end up biting people who expected to see that mark in the response text?