In response to the garbage problem

Today the problem garbled response back to the browser occurred in the time to write a business scenario

Solution

1 is provided in response to the encoding stream

1 response.setCharacterEncoding("utf-8");

General Settings response stream encoding on the line, but different browsers default resolution encoding is not the same, may still garbled, it is necessary to set the second

2 Set the browser parses encoded format

response.setContentType("text/html;charset=utf-8");

This can be the perfect solution Chinese garbage problem

Guess you like

Origin www.cnblogs.com/zyfBlogShare/p/11906193.html