❔ How to fix encoding in Razor View?

Hello, I want to show error as JS alert
@if (ViewBag.Error != null)
{
var error = ViewBag.Error as ErrorViewModel;
<script>
alert("@error.Message");
</script>
}
@if (ViewBag.Error != null)
{
var error = ViewBag.Error as ErrorViewModel;
<script>
alert("@error.Message");
</script>
}
message contains polish characters and I got this as shown on picture. How to fix encoding to show polish characters correctly. I have set meta charset as UTF-8
5 Replies
Somgör from Human Resources
Try UTF-16 maybe?
Ⰽⰰⱈⰻⰽⱄ
still similiar issue
Angius
Angius12mo ago
UTF-8 should be enough The only thing wrong so far is the use of ViewBag It's shit, yes, but not so shit to influence character encoding Is the encoding set in the HTML metadata as well? The lang attribute maybe?
Ⰽⰰⱈⰻⰽⱄ
yes, it's utf-8 and lang set to pl
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts