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

Json Content-Type and explicity encoding declaration #455

Closed
MichelFortes opened this issue Aug 8, 2020 · 4 comments
Closed

Json Content-Type and explicity encoding declaration #455

MichelFortes opened this issue Aug 8, 2020 · 4 comments

Comments

@MichelFortes
Copy link

Like the Spring developer team has done, it would be interesting to consider that all content-type "application/json" responses where encoded with UTF-8 charset.

From Spring Team:
/**
* A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
* @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
* since major browsers like Chrome
*
* now comply with the specification
and interpret correctly UTF-8 special
* characters without requiring a {@code charset=UTF-8} parameter.
*/
@deprecated
public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";

@MichelFortes MichelFortes changed the title Json Content-Type and explicity enconding declaration Json Content-Type and explicity encoding declaration Aug 8, 2020
@pierrediderot
Copy link

+1.

@natebosch
Copy link
Member

natebosch commented Jul 15, 2021

Closing in favor of #175

The expected pattern to use today when you know the result is json is jsonDecode(utf8.decode(response.bodyBytes)). We should consider changing the default decoding so that fewer users get confused by this.

@DeD1rk
Copy link

DeD1rk commented Jul 16, 2021

@natebosch you linked the wrong issue, also in another issue.

@natebosch
Copy link
Member

@DeD1rk - corrected. Thanks for the heads up!

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

No branches or pull requests

4 participants