Using the SPRINGMVC, in the controller layer to transmit a JSON to the foreground, background display no problem, Chinese normal display and to the front desk. This article mainly introduces the use of Ajax to pass the JSON to the foreground Chinese question mark problem solving method, the need for a friend's reference, hope to help everyone.
Chinese becomes a question mark.
Later found, because the controller returned JSON with @responsebody, and spring source @responsebody implementation class found its default encoding is Iso-8859-1, and the project is encoded as UTF-8, So the Chinese language will appear garbled.
Here I use the annotations to solve:
@RequestMapping (value= "/echarts.do", produces = "application/json; Charset=utf-8 ")
This method is more suitable for the new version of spring, the version of this project:
<spring.version>4.1.4.RELEASE</spring.version>
The above is a small part of the introduction of the use of Ajax to pass the JSON to the front desk Chinese appear question mark problem solving method, I hope to be helpful to everyone.