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

HttpResponse.parseAsString() should respect charset Content-Type parameter #41

Closed
wonderfly opened this issue Jan 9, 2015 · 7 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@wonderfly
Copy link
Contributor

From yan...@google.com on October 12, 2011 19:17:05

Version of google-http-java-client (e.g. 1.5.0-beta)? 1.5.0-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? All Describe the problem. HttpResponse.parseAsString() uses the platform's default charset when parsing the content, even if the Content-Type header looks like this:

Content-Type: application/json; charset=UTF-8

Reference: https://code.google.com/p/google-http-java-client/source/browse/google-http-client/src/main/java/com/google/api/client/http/HttpResponse.java#420 How would you expect it to be fixed? I would expect parseAsString() to read the charset parameter from the Content-Type header to determine the character set to use to parse. Typically this will be UTF-8, which will typically be different from the platform's default encoding.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=41

@wonderfly wonderfly added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. imported priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 9, 2015
@wonderfly wonderfly self-assigned this Jan 9, 2015
@wonderfly
Copy link
Contributor Author

From yan...@google.com on October 28, 2011 09:46:45

Labels: -Milestone-Version1.6.0 Milestone-Version1.7.0

@wonderfly
Copy link
Contributor Author

From rmis...@google.com on November 14, 2011 09:27:31

Looks like this was fixed by Yaniv in http://codereview.appspot.com/5320060/ .

Status: Fixed

@wonderfly
Copy link
Contributor Author

From yan...@google.com on November 14, 2011 09:37:43

The fix I made was to assume the content type is UTF-8 which is usually the case. In theory the charset might not be UTF-8, so the ideal fix is to actually read the charset parameter. But let's punt the ideal fix until we hear actual user demand for this feature.

Status: Accepted
Labels: -Milestone-Version1.7.0

@wonderfly
Copy link
Contributor Author

From esch...@gmail.com on February 14, 2012 13:51:33

Right, we need to have string in encoding specified by response's Content-Type header
Or at least have access to it to do not parse headers manually

@wonderfly
Copy link
Contributor Author

From yan...@google.com on May 21, 2012 12:52:31

Status: Started
Owner: yan...@google.com
Cc: rmis...@google.com mlin...@google.com
Labels: Milestone-Version1.10.0

@wonderfly
Copy link
Contributor Author

From yan...@google.com on May 21, 2012 12:58:20

http://codereview.appspot.com/6218059/

@wonderfly
Copy link
Contributor Author

From yan...@google.com on May 22, 2012 05:07:12

Status: Fixed

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 6, 2020
clundin25 pushed a commit to clundin25/google-http-java-client that referenced this issue Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants