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

Character set not defined in some responses #96

Closed
jonnybazookatone opened this issue May 6, 2016 · 3 comments
Closed

Character set not defined in some responses #96

jonnybazookatone opened this issue May 6, 2016 · 3 comments

Comments

@jonnybazookatone
Copy link
Contributor

This is causing problems for users of the Python API client.

For the original ticket, see:
andycasey/ads/pull/52

@takerukoushirou:

Sure, that particular case for example was the paper returned by query identifier:2012Natur.486..502B for the fields 'bibcode', 'title', 'author', 'bibstem', 'pubdate', 'property', 'pub'.

The server returns the content-type application/json, and the Python requests package only checks for a charset definition in the content-type or defaults to ISO-8859-1 for text content in the requests utility function get_encoding_from_headers (i.e. in our case this yields none). Once the text property of the response object is queried, and as no encoding was set, the apparent (=guessed via chardet) encoding property is used to transform the content before an attempt is made to decode the JSON data.

The simplest solution is to return a content-type of application/json; charset=utf-8.

@jonnybazookatone
Copy link
Contributor Author

After some consideration, I think the client should be modified. See the PR on the client.

@romanchyla
Copy link
Contributor

I agree that the client should be fixed but I'm reopening this issue because universally we should return utf-8 header. If we do not, then it is also our problem.

@romanchyla romanchyla reopened this May 12, 2016
@jonnybazookatone
Copy link
Contributor Author

I can understand your reasoning, but I don't think this issue is appropriate. I opened a new one here:

#99

This ticket was directly related to JSON problems, and so the linking to other repos will give the wrong idea that this is still an issue. However, in terms of JSON, I think we're fine in terms of being RFC compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants