SukkaW / DisqusJS

:speech_balloon: Render Disqus comments in Mainland China using Disqus API
https://disqusjs.skk.moe
MIT License
646 stars 56 forks source link

建议在fetch前对GET参数进行encodeURIComponent #50

Closed renzibei closed 4 years ago

renzibei commented 4 years ago

经过测试,fetch自动对unicode字符如中文进行utf8 encode。但是在IE浏览器上,没有fetch,而替代的行为则不是使用utf8 encode,导致了GET的参数编码不一致。 如果要重现这一行为,可以分别使用任意系统的非IE浏览器与IE浏览器访问该网页,并使用开发者工具查看list.json请求的request header,IE浏览器的请求头编码是不同的。 经过测试,disqus API的服务器会使用与decodeURIComponent一致的行为对GET参数进行解码,故先对参数进行encodeURIComponent可以在保持向后兼容的同时也对不同浏览器行为保持一致。