none
razor and special characters like æøå RRS feed

  • Question

  • hi all

    i have a problem with razor that i hope you can help me with.

    The problem is that i cannot get it to convert write æøå.

    This is the example that fails to do the right thing:

    @if (Model != null)
    {
        string danishChars = "æøå";
        @:var name1 = '@danishChars';
        @:var name2 = 'æøå';
    }

    The result is this:

    var name1 = 'æøå';
    var name2 = 'æøå';

    As you can see if i write æøå directly it is fine, but if it is passed from a string it writes using the wrong encoding.

    Can anyone help me with that?

    • Moved by CoolDadTx Wednesday, February 27, 2019 3:00 PM ASP.NET related
    Wednesday, February 27, 2019 12:26 PM

All replies