German umlauts not working in ListView's client template when coming from resources

4 posts, 1 answers
  1. dbCF
    dbCF avatar
    4 posts
    Member since:
    Mar 2015

    Posted 01 Jul 2015 Link to this post

    Hi,

     

    I've a MVC ListView which was working perfectly until I've localized it to German. My resources are managed in Visual Studio's Resource Designer, the typical way I'd say. If any of these resources contains an umlaut and is used directly in the template, it will be converted to something like "ö". The unescaped hash sign breaks the template. I've tried several attempts to fix this issue, but none of them worked:

    1.<script type="text/x-kendo-tmpl" id="recordLinesTemplate">
    2.@Resources.Resources.BtnDeleteLine // "Zeile l&#246;schen"
    3.@Resources.Resources.BtnDeleteLine.Replace('#', 'X') // "Zeile l&#246;schen"
    4.@((Resources.Resources.BtnDeleteLine).Replace('#', 'X')) // "Zeile l&#246;schen"
    5.@Resources.Resources.BtnDeleteLine.Replace("ö", "ö") // "Zeile l&amp;ouml;schen"
    6.@WebUtility.HtmlEncode(Resources.Resources.BtnDeleteLine) // "Zeile l&amp;#246;schen"
    7.</script>

    Out of curiosity, I've tried to encode the umlaut directly in the resource, but the ampersand gets encoded as well.

    Any ideas how to resolve this issue?

    Beste Grüße with two umlauts,

       Carsten

  2. dbCF
    dbCF avatar
    4 posts
    Member since:
    Mar 2015

    Posted 01 Jul 2015 in reply to dbCF Link to this post

    PS: The forth attempt is not shown correctly. I've tried to replace the "ö" with "& ouml;".
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Answer
    Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 03 Jul 2015 Link to this post

    Hello Carsten,

    You can avoid the problem by preventing the encoding using the Html.Raw helper:
    @Html.Raw(Resources.Resources.BtnDeleteLin)


    Regards,
    Daniel
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. dbCF
    dbCF avatar
    4 posts
    Member since:
    Mar 2015

    Posted 03 Jul 2015 in reply to Daniel Link to this post

    Perfect, works like a charm! Thanks a lot.
Back to Top
UI for ASP.NET MVC is VS 2017 Ready