Tetrospectiva
Tetrospectiva

Reputation: 11

How to set utf-8 encoding for files in Visual Studio for all new solutions

I want to all my text files (.cs, .cpp, ...) in Visual Studio (2022) to UTF-8

There is one solution for this situation when data in file cannot be saved in default system codepage: How to set standard encoding in Visual Studio. But my problem is data COULD be saved in default system codepage (my codepage is "Windows-1251"). But other software (for example GitHub) cannot always read sources in my system codepage and I get " Z̴̜̰̖҇̈́͜a҉̢̟̌͞ļ̴̱͇̓̂͋͠g̶̖҇́̍̓͜o̶̙̞̓̄́͜͝" " text. Therefore I seek the way to force VS save all text files in UTF-8 by default. I have no idea why the heck someone wants to save text data in codepage other then UTF-8.

The solution that I found is that I manually change the encoding of the file after it is created (see pictures).

enter image description here

enter image description here

Also I found guide-solution for Windows. The idea is to set UTF-8 to all Windows OS. This solves the problem.

Upvotes: 0

Views: 3185

Answers (0)

Related Questions