Resource Enhancement in Javascript

1

I have an Asp.Net MVC project where I use resource, but I'm having problems with accenting other special characters. Home Example:
I have the following Resource:

Name                   |  Value
MSG_SESSAO_EXPIRADA    |  *Sessão expirada!

In my View I have:

<script type="text/javascript" charset="utf-8">
      alert('@Resources.MSG_SESSAO_EXPIRADA');
</script>

Obtained is:

Sess&#227;o expirada!

That is, it can not display ã , but does the conversion. Home Could someone help me?

    
asked by anonymous 24.08.2015 / 19:54

2 answers

0

I managed to use an interesting alternative: Home In my alert I used the Raw of HTML Helper and it worked perfectly.

alert('@Html.Raw(Resources.MSG_SESSAO_EXPIRADA)');
    
24.08.2015 / 20:52
1

Your code in html has charset="utf-8" . Your resource file must be in UTF-8 format as well, otherwise it may cause divergence in the charset.

An alternative is to write your Resource, converting the required characters using the character relationship in the Unicode / UTF8 Table

Example: Instead of ã type \u00E3

    
24.08.2015 / 20:06