解决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导入上述文件即可。
日行一善, 日写一撰