I’m coding an ASP.NET core application. I read a record of SQL database and I want to show it in my html page through a Jquery function. It’s a part of my code:
//some code...
<script charset="utf-8" type="text/javascript">
$(document).ready(function () {
var materialname = [];
@if (Model.Count() != 0)
{
foreach (var item in Model)
{
@:console.log('name: ' + '@item.material.StoreName');
@:materialname.push('@item.material.StoreName');
}
}
});
</script>
When I run this code, it’s showed an incorrect string in console.
for example, StoreName in DB is:
but it is showed in console like this:
name: محصول دسته AB اندازه 5mm
How can I correct this and show a right encoding char?