Check out the upcoming VSCode 1.48 (July 2020) browser support.
It also solves issue 33720, where you had to force encoding for the full project before with, for instance:
"files.encoding": "utf8",
"files.autoGuessEncoding": false
Now you can set the encoding file by file:
Text file encoding support
All of the text file encodings of the desktop version of VSCode are now supported for web as well.

As you can see, the encoding list includes ISO 8859-1, which is the closest norm of what "ANSI encoding" could represent.
The Windows codepage 1252 was created based on ISO 8859-1 but is not completely equal.
It differs from the IANA's ISO-8859-1 by using displayable characters rather than control characters in the 80 to 9F (hex) range
From Wikipedia:
Answer from VonC on Stack OverflowHistorically, the phrase "ANSI Code Page" was used in Windows to refer to non-DOS encodings; the intention was that most of these would be ANSI standards such as ISO-8859-1.
Even though Windows-1252 was the first and by far most popular code page named so in Microsoft Windows parlance, the code page has never been an ANSI standard.
Microsoft explains, "The term ANSI as used to signify Windows code pages is a historical reference, but is nowadays a misnomer that continues to persist in the Windows community."
Auto detect ANSI encoding
Visual Studio Code distorts ANSI characters
Running ANSI C in VSCode Windows
visual studio code - CSV Files ANSI encoded was reencoded by VSCode in UTF8. How to come back to ANSI? - Stack Overflow
How can I make all these letters appear correctly?
I can think of two options :
- Convert the file to UTF-8. – This is what I recommend.
- Configure VS Code to auto-detect the most proper encoding.
The second option is preferable if you never want to change the encoding of any files.
Option 1. Convert the file to UTF-8
The acronym ANSI stands for American National Standards Institute.
The problem with ANSI encoding is that – although the name
suggests that it's following a standard – it is conditional
on what natural language the text is written in.
In the case of Western European (Latin) languages,
"ANSI" encoding means the code page Windows-1252.
1
1a. Make VS Code use the correct encoding
In VS Code, instead of looking for ANSI encoding,
look for Windows-1252.
I clicked UTF-8 > Reopen with Encoding, and VS Code
displayed
"Western (Windows 1252) Guessed from content" as its
top suggestion.

^ click to enlarge
VS Code correctly guessed the encoding Windows 1252.
If you don't want to change the encoding, you're now all set and
done.
Otherwise, it remains to convert the file to UTF-8 encoding.
1b. Convert to UTF-8
The status bar now displays Windows 1252 instead of UTF-8.
Click on Windows 1252 and then on Save with Encoding :

Now click on "UTF-8 utf8" :

This converts the file's non-ASCII characters to UTF-8 and encodes the file as UTF-8.
Option 2. Configure VS Code to auto-detect the encoding
If you don't want to convert to UTF-8, and if you experience this problem every time you open another file – you may prefer to set VS Code to always auto-guess the encoding.
To achieve this, you need to enable the Auto Guess Encoding
feature of VS Code.
Press Ctrl+,
2
(comma) and paste or type autoGuessEncoding.
Check the box where it says :
"When enabled, the editor will attempt to guess the character set
encoding when opening files.
This setting can also be configured per language.
Note, this setting is not respected by text search.
Only Files: Encoding is respected."
3

3. The confusion about what "ANSI" encoding means
Searching the internet to find out what "ANSI" means in the context of
encoding may cause confusion.
You might encounter that ANSI is "a misnomer",
which is true but, not of much practical help.
What clears up the confusion is to realize that when Microsoft writes
"ANSI" in the status bar of notepad.exe,
it typically means Windows-1252.
For natural languages other than Western European,
see the table below.
Other well-known text editors, such as Notepad++, have
adopted this convention and also write "ANSI" in the status bar.
Windows-1252 is sometimes called code page 1252 or CP-1252. Likewise for the other code pages.
| ANSI encoding | Language/Alphabet |
|---|---|
| Windows-1250 | Slavic languages – Latin alphabet (e.g. Polish) |
| Windows-1251 | Slavic languages – Cyrillic alphabet (e.g. Ukrainian) |
| Windows-1252 | Western European languages (French, German, Scandinavian, Spanish, Swahili …) |
| Windows-1253 | Greek |
| Windows-1254 | Turkish, Latin Azeri, and Latin Uzbek |
| Windows-1255 | Hebrew |
| Windows-1256 | Arabic, Farsi, Urdu |
| Windows-1257 | Baltic languages: Estonian, Latvian, Lithuanian |
| Windows-1258 | Vietnamese |
| Windows-1270 | Sami languages |
References
- "ANSI" stands for American National Standards Institute
- Character sets listed by language
- The code page Windows-1270 | Sami languages
- Microsoft official encoding information
- Windows code pages | Wikipedia
- Macintosh emulation code pages | Wikipedia
- The default settings in VS Code
- Wikipedia refers to ANSI encoding as "a misnomer"
- Download page for Notepad++
1 For a list of what "ANSI" could mean, see the table in Section 3.
2
On macOS, press ⌘ instead of Ctrl.
For Linux users, "ANSI" typically means Windows-1252 – just as on
Windows.
For macOS users, try to see what VS Code suggests as
Guessed from content.
Or else have a look at
Macintosh emulation code pages at Wikipedia.
3 See the default settings in VS Code.
Click on UTF-8 and select Windows 1252 or ISO 8859-1. Both will work in this case if it's only å, ä and ö that is the problem. You can then choose "Save with Encoding" which should open the file with the correct codec next time in my experience.
Hey all, I'm currently working as a frontend web dev, but over the xmas holidays I thought I would learn C, since it's not supposed to be a big language and I thought it might be fun (and useful, in the long run). I got "The C Programming Language Second Edition" by Brian Kernighan & Dennis Ritchie. It's quite an old book which teaches you ANSI C (C89). I downloaded MinGW and the VSCode C/C++ extension.
The only way I can compile and run my hello_world.c file as C89 is by manually adding "-ansi", in the tasks.json file in the args list. But I should be able to set C89 as the default under the C/C++ extension settings. There is a setting I can see which says
C_Cpp > Default C Standard
The default value to use in a configuration if cStandard is either not specified or set to ${default}.
So I select "gnu89" from the dropdown, then when click "Run Build Task..." it compiles it with a more modern spec of C, not what I wanted. Can anyone help me out with this? The setting seems to do nothing.
Also, even when I add "-ansi" to the build task, running the code with Code Runner ignores it and compiles it to a more modern spec of C before running it. I know because I'm getting errors which shouldn't be a problem in C89.
Any help would be super appreciated!