Skip to content

MappingJackson2HttpMessageConverter default character set issue #25304

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

Closed
kyucumber opened this issue Jun 23, 2020 · 2 comments
Closed

MappingJackson2HttpMessageConverter default character set issue #25304

kyucumber opened this issue Jun 23, 2020 · 2 comments

Comments

@kyucumber
Copy link

kyucumber commented Jun 23, 2020

Version: Spring Framework 5.2.7

MappingJackson2HttpMessageConverter

 * <p>By default, this converter supports {@code application/json} and {@code application/*+json}
 * with {@code UTF-8} character set. This can be overridden by setting the
 * {@link #setSupportedMediaTypes supportedMediaTypes} property.

The above comment says that MappingJackson2HttpMessageConverter's default charater set is UTF-8.

image

But my MappingJackson2HttpMessageConverter's default characterSet is null.

Is the comment wrong? Or am I doing somethig wrong?

Is the default character set deprecated?

If the default character set is deprecated, I think it would be better to delete the content from the comment.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 23, 2020
@kyucumber kyucumber reopened this Jun 23, 2020
@bclozel
Copy link
Member

bclozel commented Jun 23, 2020

I'm not sure I understand the issue. JSON encoding is UTF-8 by default (see #22788).
This defaultCharset attribute is inherited from its class hierarchy - being null might be perfectly acceptable since it's marked as @Nullable.

Do you have a sample application that shows an incorrect behavior? If so, could you share it with us?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Jun 23, 2020
@kyucumber
Copy link
Author

kyucumber commented Jun 23, 2020

@bclozel

I saw the document (#22788)
Thank you.

It works well in spring applications.
However, some tests using mockMvc do not work normally.

The defaultCharacterSet is UTF-8 in the comment of the MappingJackson2HttpMessageConverter class.
However, the defaultCaracterSet value of the parent class value was null.
So I was confused.

I'll close because I'm sure there's no problem with that content.
Thank you.

@rstoyanchev rstoyanchev removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 25, 2020
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