Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 create new files with ansi encoding

I'm using Visual Studio 2017. When I create a new view when developing asp.net core MVC, the new file is saved with ANSI encoding. To solve it, I need to open the file in Notepad++ and then change the encoding to UTF8 with BOM.

Update: Its only asp.net views that are created in ANSI, all other files like .cs are in utf8 by default.

like image 339
Nils Anders Avatar asked Mar 20 '17 11:03

Nils Anders


People also ask

How do I change the encoding in Visual Studio 2017?

Set the option in Visual Studio or programmaticallySelect the Configuration Properties > C/C++ > Command Line property page. In Additional Options, add the /utf-8 option to specify your preferred encoding. Choose OK to save your changes.

How do I change my encoding to ANSI?

Step 1 – Open the Raw Data file in Notepad. Step 2 - Go to the File menu; choose "Save As". Step 3 - Change the Encoding option from UTF-8 to ANSI and save your file. Step 4 - Choose OK when a warning about converting to ANSI encoding appears.

How do I change ANSI TO UTF-8?

3. Choose "UTF-8" from the drop-down box next to "Encoding" and click "Save." Your text file will be converted and saved in the UTF-8 format, although the file extension will remain the same. You can now able open and edit the document at any time and your special characters will be preserved.

How do I change the encoding code in Visual Studio?

In the bottom bar of VS Code, you'll see the label UTF-8. Click it to open the action bar and select Save with encoding. You can now pick a new encoding for that file.


1 Answers

Convert your ANSI files to UTF-8. I used notepad++ for that and symbols and accents render was fine then.

Also you can take a look at this post MVC .net core is not displaying special characters correctly

like image 98
Ricker Silva Avatar answered Sep 22 '22 05:09

Ricker Silva