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.
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.
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.
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.
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.
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
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