原因:因为spring mvc 默认使用ISO-8859-1编码处理中文字符!
解决方案1)可以对要返回的字符串进行编码,再返回!
new String("你好,我是测试号!!".getBytes("UTF-8"),"ISO-8859-1");
解决方案2)可以在requestMapping中指定字符串编码
@RequestMapping(value="/verify",method=RequestMethod.POST,produces="application/json; charset=utf-8")
解决方案3)在配置文件中加入如下代码
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes" value = "text/html;charset=UTF-8" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>