Click here to Skip to main content
14,733,443 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi brothers
i have problem with json data file when i'm trying retrieve data with arabic language

From: "��"
NameAR: "����� ����"
NameEN: "����� �������"
Tax: "�����"
To: "���"


this is json file

{
"NameEN" : "الأسم انجليزي",
"NameAR" : "الأسم عربي",
"From" : "من",
"To" : "الي",
"Tax" : "ضريبة"
}

<pre lang="Javascript">
app.service('translationService', ['$resource', '$cookies', function ($resource, $cookies) {
    var language = $cookies.Cookie_Language;
    this.Translation = function ($scope) {
        var translatorPath = '/Translations/Translator/Translation_' + language + '.json';
        $resource(translatorPath, {
            contentType: "application/json; charset=utf-8", dataType: "json",
        }).get(function (data) {
            alert(data.NameEN);
            $scope.translation = angular.fromJson(data);
        });

    };
}]);
</pre>
<


this is problem
<img src="http://www.gulfup.com/?ZQKmIx" />
Posted
Updated 30-Aug-18 0:39am

There are no specific issues with Arabic texts. All parts of the Web support Unicode, and this script is supported on nearly all modern systems by default, without a need to install or configure anything culture-specific. But you need to indicate what encoding you are using.

One possible missing piece could be the "charset" of the content type of your HTML page, which can be fixed in the http-equiv attribute of the meta element, a child if the head element:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

I could be something else, so checkup everything to make sure that you don't use any other encodings anywhere in between.

—SA
   
Comments
Golden Mind 1-Nov-14 20:59pm
   
Thanks it's works successfuly
   
That's great. You are very welcome.
Good luck, call again.
—SA
Please make sure your json file saved as
Encoding to UTF-8
, for doing this open json file in notepad and do save as , you can see on bottom of the popup as
Encoding: ANSI change it into
Encoding:UTF-8
. it will work....
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900