无法从JSONP文件正确读取特殊字符 [英] Special characters are not being read from a JSONP file correctly
问题描述
我有一些JSONP文件,其数据如下:"ActiveLabel":"Site Survey Exact-Built™"
(请注意™
char).
I have some JSONP files which have data like: "ActiveLabel":"Site Survey Exact-Built™"
(notice the ™
char).
当我从文件中读取数据时,通过创建脚本标签并使用该标签来评估JSONP文件,我得到.
应该在™
所在的位置.
When I read the data from the file, by creating a script tag and using that to evaluate the JSONP file, then I get �
where ™
should be.
我尝试在生成的用于加载JSONP的脚本标签上设置 charset ="UTF-8"
,但这无济于事.
I tried setting charset="UTF-8"
on the script tags I generate to load the JSONP, but that isn't helping.
有什么办法可以纠正这个问题吗?
Any idea what I can do to correct this?
推荐答案
我在创建的< script>
元素上使用了 charset ="Cp1252"
,那行得通.得到正确的字符集..
I used charset="Cp1252"
on the <script>
elements that I was creating, and that worked. Got to get the charset right..
这篇关于无法从JSONP文件正确读取特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!