V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  rookiemaster  ›  全部回复第 2 页 / 共 2 页
回复总数  25
1  2  
@rookiemaster 然后返回 hello 而不是 newhello 也是正常的
@jinliming2
我把 Controller 换成这样,浏览器就正常了
@RestController
public class TmpController {
// @GetMapping(value = "/test",produces = "application/json")
@GetMapping(value = "/test",produces = "application/json;charset=GBK")
public String test() throws UnsupportedEncodingException {
String hello = "你好你好";
String newhello = new String( hello.getBytes("GBK") , "GBK");
return newhello;
}
}
这样的 {"code":0,"message":"鎿嶄綔鎴愬姛","data":"锟斤拷锟�"}
然后 ContentType 是 application/json;charset=GBK
@KaliZ thx
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2421 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 12:40 · PVG 20:40 · LAX 05:40 · JFK 08:40
Developed with CodeLauncher
♥ Do have faith in what you're doing.