Reputation: 161
I am currently developing an ASP.NET MVC 5 application, but I have issues with characters like "áéíöőúű" etc. The issue is in my _layout.cshtml
.
The characters looks like are encoded like ISO-8859 characters, even though it is set to UTF-8.
For example: "applikáció" renders as "applikáciĂł"
What I already checked and tried:
web.config
, in the first row is is set the xml encoding to utf-8, so that should not caused the problem@Renderbody
, so I assume it was not about keyboard language settingsHere is the complete code I copied, navbar items, title and footer contains characters
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Applicatión</title>
@using System.Configuration;
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/fontawesome")
@Scripts.Render("~/bundles/modernizr")
@Styles.Render("~/Content/DevExtremeBundle")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/Scripts/DevExtremeBundle")
</head>
<body>
<nav class="navbar navbar-expand-lg bg-light fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="~/Home/Index">Főoldal</a>
<a class="nav-link" href="~/Jobs/Index">Munkák</a>
<a class="nav-link" href="~/EmailAddressGroup">Emailezés</a>
</div>
</div>
</div>
</nav>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p class="h6">© @DateTime.Now.Year - My ASP.NET Application, applikáció</p>
</footer>
</div>
@*<script src="~/Scripts/bootstrap.min.js"></script>*@
@*@RenderSection("scripts", required: false)*@
</body>
</html>
I am out of ideas how to fix it, so any help appreciated.
Upvotes: 0
Views: 416
Reputation: 161
In web.config, setting the globalization solves the problem.
Have to place following inside the system.web:
<system.web>
<globalization fileEncoding="utf-8" />
</system.web>
And it is fine.
Upvotes: 1