Skip to content

Getting a request with a BOM mark #2320

@GP89

Description

@GP89

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions