Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid behavior for .text() and .json() if encoding is not known #109

Closed
fafhrd91 opened this issue Jul 8, 2014 · 5 comments
Closed

Valid behavior for .text() and .json() if encoding is not known #109

fafhrd91 opened this issue Jul 8, 2014 · 5 comments
Labels

Comments

@fafhrd91
Copy link
Member

fafhrd91 commented Jul 8, 2014

What should be valid behavior for .text() and .json() if encoding is not known.

see #108

@kxepal
Copy link
Member

kxepal commented Jul 8, 2014

About JSON there is RFC 7159 recommendation:

JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32.  The default
encoding is UTF-8, and JSON texts that are encoded in UTF-8 are
interoperable in the sense that they will be read successfully by the
maximum number of implementations; there are many implementations
that cannot successfully read texts in other encodings (such as
UTF-16 and UTF-32).

As for text/plain it is a different story:

A critical parameter that may be specified in the Content-Type field
for "text/plain" data is the character set.  This is specified with a
"charset" parameter, as in:

 Content-type: text/plain; charset=iso-8859-1

Unlike some other parameter values, the values of the charset
parameter are NOT case sensitive.  The default character set, which
must be assumed in the absence of a charset parameter, is US-ASCII.

@kxepal
Copy link
Member

kxepal commented Jul 8, 2014

About behaviour, raising UnicodeDecodeError is ok. May be only with more better description like: "expected utf-8 encoded data, found something weird" etc.

@fafhrd91
Copy link
Member Author

fafhrd91 commented Jul 8, 2014

sounds good

@fafhrd91
Copy link
Member Author

fafhrd91 commented Sep 1, 2014

i suppose we do not need to do anything about this.

@fafhrd91 fafhrd91 closed this as completed Sep 1, 2014
@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants