© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
9 replies
Ⰽⰰⱈⰻⰽⱄ

❔ 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
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Razor pages view
C#CC# / help
4y ago
Avalonia ViewLocator not ViewLocating
C#CC# / help
2y ago
MVC w/ Razor View - Form POST
C#CC# / help
2y ago