UTF-8 和 Javascript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6790593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UTF-8 and Javascript
提问by halna frédéric
I use Javascript to get data in a HTML pages define with a charset UTF8
我使用 Javascript 来获取使用字符集 UTF8 定义的 HTML 页面中的数据
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
my javascript method is load with a charset UTF8
我的 javascript 方法加载了字符集 UTF8
<script type="text/javascript" charset="utf-8" src="../ressources/js/test.js"></script>
but i have a encode problem, when i get data with "innerHTML"
但是当我使用“innerHTML”获取数据时,我遇到了编码问题
ex: salari?s
例如:salari?s
is there something I missed ?
有什么我错过了吗?
回答by
The encoding of the files must be set to UTF8.
文件的编码必须设置为 UTF8。