0
I’m having trouble making an Ajax call using Angularjs because the strings that have accents are returning null, in response to the call, my PHP is returning a JSON json_encode($data)
, and upon receiving the reply I am transforming JSON into an array angular.fromJson(data)
, as it was on my server-side.
My PHP header is configured header("Content-Type: text/html; charset=ISO-8859-1",true)
, when I return the var_dump
can see all strings, accented or not. The problem is with JSON, I think the solution is a header suitable for my request.
This is my script:
$http.get("busca_tamanhos.php", {headers: {'Content-Type': 'application/json, text/plain'}}).success(function(data){
$scope.tamanhos = angular.fromJson(data);
$window.console.log(data);
});
PS: I can see unstressed strings, and my database is ISO-8859-1.
JSON is utf-8 by definition, you cannot use that charset you are trying to.
– Henrique Barcelos