Charles Response 中文乱码
前言
正文
前提:
Charles版本:4.0
方法1:修改Info.plist(有的版本好用,3.11.2以后不好用)
方法2:重定向
Strange characters appear in the response 这是Charles官网中常见问题中的一个,这不就是我遇到的问题么,看看官方怎么说的。
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.
检查服务器在返回数据时有没有设置字符集,如果没有,Charles会猜测字符集,有可能不正确。也要注意字体,选一个能正确显示对应字符集的字体。 查看response header,
Rewrite之前的Response Headers。发现没有指定字符集,那就加一个。 使用Tools-> Rewrite功能,设置如图所示。(此图为新加的图) Name:Content-Type Value:application/json;charset=UTF-8
使用Rewrite功能改写Response Headers 重新请求,可以看到已经多了一个Content-Type
Rewrite之后的Response Headers 这个时候,再看Notes也有了一些内容
Rewrite之后的Notes 这个时候,在查看,乱码就没有了。