Question

I edit the text, my english is very, very... bad

Hi!!!

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)??

Tnks!!

<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>
1
0
5/4/2017 4:48:29 PM

Accepted Answer

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 çéá...

Tnks!!!

0
4/3/2017 2:19:34 PM

Popular Answer

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.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow