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

Last Reply 11 months ago By anvina

Posted 11 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%">

@section scripts  
    $(function () {
        var routers=  endmed "  + " @routerList ";
end section


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


Posted 11 months ago

Found the answer in this thread!

thank you for your help!

If we use html raw then it will not encode