I edit the text, my english is very, very... bad
I have a problem with UTF-8 in Visual Studio 2017.
I work with Asp.Net Core 1.1 and need UTF-8 in my CSHTML files.
The Some way i found to change the codification is goining in File->Save As..->In save button, click on the Save with Codification and change to Unicode (UTF-8).
But i to need do this every time, in every cshtml file.
I can set the default Codification of CSHTML , as Unicode(UTF-8)??
<head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title> - Teste_db</title> <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css" /> <link rel="stylesheet" href="/css/site.css" />
<body> ... <h2>Viewï¿½ï¿½ </h2> ... </body>
I solved my problem!!!
I found the default .cshtml files from MVC.
The files is in C:\Users\USER_NAME.nuget\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc\1.1.0\Templates\ViewGenerator\
I edited them with notepad++, changed the format to UTF-8, now i can put a especial caracteres like Ã§Ã©Ã¡...
The default encoding for cshtml files should be UTF-8 anyways. If it is not, some other tool messed up your files.
The VS addon fix-file-encoding lets you select which encoding should be used depending on the file type.
As a side note, add
<meta charset="utf-8"/> to the
<head> of your HTML5 files so they are rendered correctly.