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

chapter 2-1 #51

Open
Godxia opened this issue Jul 29, 2020 · 1 comment
Open

chapter 2-1 #51

Godxia opened this issue Jul 29, 2020 · 1 comment

Comments

@Godxia
Copy link

Godxia commented Jul 29, 2020

idea测试出中文乱码问题。
java.lang.AssertionError: Response content
Expected: "[{"id":1,"name":"测试大师","age":20}]"
but: was "[{"id":1,"name":"???è???¤§???","age":20}]"
搜了半天,file encoding都改成utf-8了,但是还是乱码。

@ponyhu
Copy link

ponyhu commented Aug 6, 2020

@RequestMapping(value = "/users", produces = "application/json;charset=utf8")

类上的注解,改为这样就可以了。

通过实现 WebMvcConfigurer 中的configureMessageConverters 这种方式,经我实测无效。

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

2 participants