Yasser B. Yasser B. - 4 months ago 12
Javascript Question

How to decode into UTF-8 using angular js or Javascript

I started recently to use angular js, I like how it works, I want to know how can I set the charset encoding as a header.

My json file contains special characters ( French language ).

something like :


Is there any way to decode that into UTF-8 after retreiving it :

here is my code :

.success(function (response) {
$scope.lineup = response;



As you initially said, you can add a request header. That way you don't have to translate it if the server supports UTF-8.

An example by Banasci:

    {header : {'Content-Type' : 'application/json; charset=UTF-8'}
}).success(function(data) {
... code here

Also, see the documentation.