javascript - 带有希伯来语值的属性文件乱码

时间:2014-10-09 19:36:46

标签: javascript properties

我有text.properties文件,其内容是:

 { "loginText": "התחבר", "b": false }

我以这种方式获得文本(它有角度但无关紧要):

   $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);

              });

1 个答案:

答案 0 :(得分:1)

您需要在页面上的元标记中设置charset以呈现UTF-8字符:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
相关问题