By default, the editor detects the encoding by looking for byte bytes or set tags. If none of them are found in the current document, the code editor attempts to automatically detect the UTF-8 encoding using sequences of scan bytes. Help VS
If VS cannot convert any sequence of bytes into valid Unicode characters, it opens the default file in the system character set. There is no magic.
source share