Format JSON correct d'une chaîne C #
Question
Si vous faites cela dans MVC:
var jsonData =
new { myimage =
"<img alt=\"\" src=\"/Content/images/ShowFPots.png\" />" };
return Json(jsonData);
Vous obtenez cela en tant que valeur
"\u003cimg alt=\"\" src=\"/Content/images/ShowFPots.png\" /\u003e"
Comment puis-je obtenir cette valeur, ou le < > interpréter correctement lorsque je les ajoute au innerHtml?
"<img alt=\"\" src=\"/Content/images/ShowFPots.png\" />"
La solution
javascript correct, encodage unicode. Ce sera bien de l'insérer dans HTML / DOM
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Unicode
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow