After setting response.setContentType("application/json; charset=utf-8"), it is still Chinese garbled characters

The first is that I confirmed that response.setContentType("application/json;charset=utf-8") is set correctly

code show as below:

img

I couldn't find the clue, I looked at the front-end request header information:

img

It was determined that response.setContentType("application/json;charset=utf-8") did not take effect, and the code was correct. After reading the code carefully, I found a possible reason, as shown in the figure:

img

Then try:

img

Try it out:

img

an interesting pit

Guess you like

Origin blog.csdn.net/qq_43842093/article/details/123829649