I make some test with ASP.NET Core MVC. I am trying to display special character like çùé.
But it is displayed as �.
Exemple :
Create new view and put :
<div>àçù</div>
By default, the .cshtml
file is encoded in "UTF-16".
The charset in HTTP response header is "UTF-8".
In _layout, the <head>
contains the <meta charset="utf-8" />
tag.
To resolve the problem, I can convert all .cshtml file to uft-8.
What's the correct way to manage encodage in ASP MVC Core?
Edit :
Visual Studio 2017 RC create .cshtml file in 'utf-8', but the scaffolding create the .cshtml file in 'ISO 8851-1'.
Can I explain to scaffolding I want .cshtml file in 'UTF-8'?
I solved it by simply opening the file with problems, confirming it was encoded as ANSI, converted it to UTF-8 and everything run smooth again. I also created a post for this, so both seem duplicated right now. MVC .net core is not displaying special characters correctly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With