Skip to content

updated get_encoding_from_headers to return utf-8 if the content type is set to application/json#5673

Merged
sigmavirus24 merged 1 commit intopsf:masterfrom
jjmaldonis:master
Nov 29, 2020
Merged

updated get_encoding_from_headers to return utf-8 if the content type is set to application/json#5673
sigmavirus24 merged 1 commit intopsf:masterfrom
jjmaldonis:master

Conversation

@jjmaldonis
Copy link
Copy Markdown
Contributor

This PR fixes #5667 by adding a small bit of code to get_encoding_from_headers that returns utf-8 if the content type is set to application/json and charset is not set. This follows RFC 4627 (ctrl+f for shall be) which reads: "JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."

…pe is set to application/json, following RFC 4627.

fixes psf#5667
@sigmavirus24 sigmavirus24 merged commit 589c454 into psf:master Nov 29, 2020
@jjmaldonis
Copy link
Copy Markdown
Contributor Author

Awesome, thanks for the fast responses here and for merging!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

r.text and r.json() return different results *in some cases*

4 participants