I've found that special characters in an existing ASP.NET MVC application are not working correcly.
I need to escape from C# (those data arrives from DB)
The following string Quadri 3° e 4° livello
What I'm doing in the cshtml is
success: function (data) {
//alert(data);
var wnd;
var selector = $('#divImport_@id');
if (!selector.data("kendoWindow")) {
wnd = selector.kendoWindow({
title: "Import da file",
modal: true,
visible: false,
resizable: false,
width: 700,
deactivate: function () {
selector.empty();
}
}).data("kendoWindow");
}
else wnd = selector.data("kendoWindow");
wnd.title('Import da file - ' + decodeURIComponent('@HttpUtility.JavaScriptStringEncode(Model.NomeCategoria)'));
wnd.content(data);
wnd.center().open();
}
What I got is the following output
How do I escape it correctly?
Thanks
Try with:
@Html.Raw(HttpUtility.JavaScriptStringEncode(Model.NomeCategoria))
as shown also here: Javascript, Razor and Escape characters. Like apostrophe
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.