Decode and display string in View using JavaScript in ASP.Net MVC

Last Reply 9 months ago By anvina

Posted 9 months ago

In the view For vb code in the view I am setting a string with UTF-8 characters "Övriga frågor"

Then i assign this string to a javascript variable routers

But when the routerlist is assigned to routers the UTF-8 characters  are not the same.

The alert displays  the string as "Övriga frågor" some kind of encoding?

This javascript string is passed to server side vb code and I want to decode it back to the original string.

how can I do that?

Below is my code from a view in mvc

<div id='dashboardItemBody' style="align-content:center;width:100%;height:100%">
    @Html.Action("_getRouter2")
</div>

@section scripts  
    $(function () {
        var routers=  endmed "  + " @routerList ";
       alert(routers);
    });
</script>
end section

 

@Code 
   Dim  routerList as string = "Övriga frågor"
End Code

 

This question does not have replies that have been liked.