I'm populating a list in javascript with a ViewBag
. The ViewBag
has a list of objects and these objects have properties with accented words. They are coming correctly from ViewBag
, but when I add the object to the javascript list, they lose the accent, leaving only strange characters.
In a word like Verification, it becomes Verificação
.
Populate my list as follows:
@foreach(var item in ViewBag.ListRequired)
{
@:var required = {
@:ExamNumber: "@item.ExamNumber",
@:TypeName: "@item.TypeName",
@:Description: "@item.Description"
@:};
@:listRequiredContent.push(required);
}
I tried to put charset="utf-8"
in my tag <script>
but I did not succeed.
There are fields on the page that have accents and text is shown correctly. The problem is only when I try to manage the information via javascript .
How can I resolve this?