charset does not work

Asked

Viewed 51 times

0

I’m trying to return a Viewbag in dialog, it even works, but does not support the accents

Code:

<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        alert("@ViewBag.Erro");
    });
</script>

1 answer

0


Use the Html.Raw() to pass the string without Razor encoding.

<script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
        alert("@Html.Raw(ViewBag.Erro)";
    });
</script>
  • Worked perfectly

  • @Diegoberleis, I’m glad I could help you! Could you mark the answer as "Best Answer" to help other people who might have the same problem?! Thanks xD

Browser other questions tagged

You are not signed in. Login or sign up in order to post.