我有 text.properties 文件,其内容是:
{ "loginText": "התחבר", "b": false }
我以这种方式获取文本(它是 Angular ,但并不重要):
$http.get('text.properties').then(function (response) {
console.log("response.data",response.data.loginText);//打印 ”?????”安慰 $rootScope.text = response.data.loginText;//也在屏幕上显示为“??????” });
现在 $rootScope.text.login 是“??????”
编辑:
这也是导致'??????':
$http.get('text.properties',
{"headers" : "Content-Type=application/x-www-form-urlencoded; charset=UTF-8"})
.success(function(data, status, header, config){
console.log("data",data);
});
最佳答案
您需要在页面上的元标记中设置字符集以呈现 UTF-8 字符:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
关于javascript - javascript - 带有希伯来语值的属性文件乱码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26286584/