Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Special characters in UTF-8 using RenderBody()

I'm developing site in ASP.NET MVC6 with Polish letters. They work just fine when I write them in _Layout.cshtml, but I'm also using RenderBody() for rendering views.

Using Html.DisplayFor(modelItem => item.ID) inside view, displays Polish characters properly, but when I use plain html and write something, all I see on the website is "?" in place of every used Polish letter.

In _layout.cshtml I have a declaration:

<meta charset="utf-8" />

And in web.config I have:

<?xml version="1.0" encoding="utf-8"?>
like image 362
MaciekAiR Avatar asked Jan 06 '23 06:01

MaciekAiR


1 Answers

I have the same problem with asp.net core aka MVC6, visual studio 2017. Especial characters like â appear � and client side validation like ViewBag.Equals("â") is not working properly.

So I change the view files (.cshtml ) codification with notepad++ from ANSI to UTF-8.

enter image description here

like image 191
user3102567 Avatar answered Jan 08 '23 19:01

user3102567