修复像这样渲染的特殊符号:’s
我需要转换 json 文件中的任何特殊符号才能正确渲染。现在它们显示为这样的
测试,
而不是像这样的
测试,
我从 json 文件中获取所有数据,如下所示:
$.each(results.Blogs, function(i, blog){
blogCount.push(i);
topicsBlog.push({
indexRank: i,
blogDescription: blog.Description,
blogDate: blog.PubDate,
blogTitle: blog.Title,
blogLink: blog.Link
});
});
并使用 Jquery 模板将其放入我的 html 中:
$('#topic-blog-links').html($('#topic-blog').tmpl(blogSplice));
有解决方案来修复这些字符吗?
I need to convert any special symbols coming through in my json file to render correctly. Right now they are showing up like this
Test’s
Instead of like this
Test's
I am grabbing all the data from a json file like this:
$.each(results.Blogs, function(i, blog){
blogCount.push(i);
topicsBlog.push({
indexRank: i,
blogDescription: blog.Description,
blogDate: blog.PubDate,
blogTitle: blog.Title,
blogLink: blog.Link
});
});
and putting it in my html using Jquery templates:
$('#topic-blog-links').html($('#topic-blog').tmpl(blogSplice));
Is there a solution to fix these characters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的字符编码必须是端到端的 UTF-8。您需要在页面中声明这一点:
并且您存储在服务器上的数据必须以 UTF-8 格式保存。如果它是来自 MS-Word(Windows-1251 格式)的转储,那么您就不走运了。
Your character encoding must be UTF-8 end-to-end. You need to declare this in your page:
And the data that you've stored on the server must be saved in UTF-8 format. If it was some dump from MS-Word (Windows-1251 format), you're out of luck.