0
When I send a JSON return and the text is accentuated, JSON breaks.
Here is the request code in the Controller
$http.post("../backend/controller/SugestaoController.asmx/comboListarSugestoes", { empresa: $rootScope.login })
.then(function (retorno) {
//console.log("teste", retorno.data);
$scope.listaSugestoes = retorno.data;
}).catch(function (retorno) {
alert("erro");
})
.finally(function () {
$scope.mostrarLoader = false;
});
Now the Server side, I will show you just how the upload is:
JavaScriptSerializer js = new JavaScriptSerializer();
String json = js.Serialize(retorno);
context.Response.Clear();
context.Response.Charset = "utf-8";
context.Response.ContentType = "application/json";
//context.Response.ContentType = "text/html";
context.Response.AddHeader("Content-Length", (json.Length).ToString());
context.Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
context.Response.Write(json);
If you have accents, JSON arrives like this:
[{nome:'felipe',funcao:'médico',idade:23
If he doesn’t, he’ll arrive normal
[{nome:'felipe',funcao:'medico',idade:23}]
I’ll try Julio, thank you.
– Felipe Santos
It worked perfectly Julio, thank you very much.
– Felipe Santos