解决charles中文乱码(附代码)

1. 将下面的代码保存为一个*.xml的文件

<?xml version='1.0' encoding='UTF-8' ?>
<?charles serialisation-version='2.0' ?>
<rewriteSet-array>
  <rewriteSet>
    <active>true</active>
    <name>modify content-type</name>
    <hosts>
      <locationPatterns>
        <locationMatch>
          <location>
            <host>xdcs-collector.ximalaya.com</host>
          </location>
          <enabled>true</enabled>
        </locationMatch>
      </locationPatterns>
    </hosts>
    <rules>
      <rewriteRule>
        <active>true</active>
        <ruleType>3</ruleType>
        <matchHeader>Content-Type</matchHeader>
        <matchValue>.*</matchValue>
        <matchHeaderRegex>true</matchHeaderRegex>
        <matchValueRegex>true</matchValueRegex>
        <matchRequest>true</matchRequest>
        <matchResponse>false</matchResponse>
        <newHeader>Content-Type</newHeader>
        <newValue>text/plain;charset=utf-8</newValue>
        <newHeaderRegex>false</newHeaderRegex>
        <newValueRegex>false</newValueRegex>
        <matchWholeValue>false</matchWholeValue>
        <caseSensitive>true</caseSensitive>
        <replaceType>1</replaceType>
      </rewriteRule>
    </rules>
  </rewriteSet>
</rewriteSet-array>

2. 打开 charles 工具->Tools->rewrite->import导入上述文件即可。

posted @ 2018-06-12 15:31  蒋励  阅读(5951)  评论(2编辑  收藏  举报