美文网首页iOS DeveloperiOS程序猿
Charles Response 中文乱码

Charles Response 中文乱码

作者: 观星 | 来源:发表于2016-08-27 10:51 被阅读5427次

    Charles版本:4.0

    修改Info.plist

    基本上网上一搜,都是这个方案,这在特定版本应该是有效的,不然,不会有那么多转发。试了一下,没有用。

    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,这个判断很可能不正确。也要注意字体,选一个能正确显示对应字符集的字体。

    查看response header,

    Rewrite之前的Response Headers

    发现没有指定字符集,那就加一个。
    使用Tools-> Rewrite功能,设置如图所示。


    使用Rewrite功能改写Response Headers

    重新请求,可以看到已经多了一个Content-Type


    Rewrite之后的Response Headers

    这个时候,再看Notes也有了一些内容

    Rewrite之后的Notes

    这个时候,再查看,乱码就没有了。

    相关文章

      网友评论

        本文标题:Charles Response 中文乱码

        本文链接:https://www.haomeiwen.com/subject/jfzzsttx.html