Charles版本:4.0
修改Info.plist
基本上網(wǎng)上一搜,都是這個方案,這在特定版本應該是有效的,不然,不會有那么多轉(zhuǎn)發(fā)。試了一下,沒有用。
Strange characters appear in the response
這是Charles官網(wǎng)中常見問題中的一個,這不就是我遇到的問題么,看看官方怎么說的。
Please check that the character encoding or charset is correctly set by the server, otherwise Charles will guess and may not guess correctly.
You may also need to choose a font that can display the charset in the response. You can change the font used in the Preferences on the User Interface tab. You will need to restart Charles for those changes to take effect.
檢查服務(wù)器在返回數(shù)據(jù)時有沒有設(shè)置字符集,如果沒有,Charles會使用自己判斷的字符集來處理response,這個判斷很可能不正確。也要注意字體,選一個能正確顯示對應字符集的字體。
查看response header,
Rewrite之前的Response Headers
發(fā)現(xiàn)沒有指定字符集,那就加一個。
使用Tools-> Rewrite功能,設(shè)置如圖所示。
使用Rewrite功能改寫Response Headers
重新請求,可以看到已經(jīng)多了一個Content-Type
Rewrite之后的Response Headers
這個時候,再看Notes也有了一些內(nèi)容
Rewrite之后的Notes
這個時候,再查看,亂碼就沒有了。