Unable to display accents correctly in VSCode 2022
19BlueMonkey92 -
Hi everyone,
I recently started using Visual Studio Community 2022 to learn C++ and I noticed a pretty big problem: accents display oddly. I saw that to display them you either had to change the runtime console font to Consolas or Lucida Console (but that doesn’t work :/), or enter the character codes (which makes writing text much more complicated and slower).
In short, I’d like to know how to display them without too much hassle.
Thanks in advance.
2 answers
-
A solution "without much fuss" in your case. Force the compiled code to use the same code page as the console.
The console uses ibm850 in Europe. You modify your project's properties, and under "C/C++", "Command Line", "Additional Options", enter: /execution-charset:.850
-
Hello
By default C and C + c only know Unicode, it is a character set without diacritic marks (accents, cedilla, crossed letters, etc.).
Typically good beginner courses indicate this quite quickly.
This "limitation" has an excellent reason to exist; these languages are cross-platform, and the Unicode set is the only one recognized by default since the early days of C on all types of OSes.
To display diacritics while keeping portability, you must write code that adapts to the OS, and that is beyond what a beginner can handle.
This is the reason why texts shown in good beginner courses do not have diacritical marks.
When I was little, the Sea Morte was only sick.
George Burns-
I think you’re talking more about ASCII, which dates from the 1960s and has very limited character representation capabilities because it encodes characters on 7 bits. Indeed, no accented characters in there.
CP850, mentioned by Dalfab, is an ASCII-compatible "extended" code page that uses the 8 bits of a byte, which allows including accented characters, in particular.
Unicode was created in the 1990s, and it aims to represent all writing systems, which are encoded in multiple bytes.
-
