鍍金池/ 問答/Java  網(wǎng)絡(luò)安全/ mock中文亂碼的問題

mock中文亂碼的問題

1、intellij idea的project已經(jīng)設(shè)置成utf-8了
圖片描述
2、文件我看了下也是utf-8的
就是一個(gè)簡(jiǎn)單的json文件

[
  {
    "description":"測(cè)試",
    "request":{
      "uri":"/demo"
    },
    "response":{
      "text":"中文"
    }
  }
]

圖片描述
3、但是為什么啟動(dòng)后,在瀏覽器中還是亂碼呢
要瀏覽器轉(zhuǎn)換成GBK才可以

我看響應(yīng)也是Content-Type: text/plain; charset=utf-8

如果使用java -jar -Dfile.encoding=UTF-8 啟動(dòng)的話瀏覽器正常了,但是terminal變成亂碼了
圖片描述
16 鍏湀 2018 10:44:47 [nioEventLoopGroup-3-2] INFO Response return:

HTTP/1.1 200
Content-Length: 6
Content-Type: text/plain; charset=utf-8

涓枃

回答
編輯回答
玩控

我在啟動(dòng)的時(shí)候設(shè)置了 java -jar -Dfile.encoding=UTF-8 這樣瀏覽器的獲得的response就是utf-8了
但是intellij idea的terminal變成亂碼了

2018年1月7日 16:16