Unable to display accents correctly in VSCode 2022

19BlueMonkey92 -  
 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

  1. Dalfab Posted messages 638 Registration date   Status Member Last intervention   102
     

    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

    3
    1. 19BlueMonkey92
       

      Okay, thanks, I’ll see if it works

      0
      1. 19BlueMonkey92 > 19BlueMonkey92
         

        Well, I can’t locate where to access those options.

        Could you please tell me where they are?

        0
      2. Dalfab Posted messages 638 Registration date   Status Member Last intervention   102 > 19BlueMonkey92
         

        Menu: project
        Submenu: project properties
        Then
         

        0
      3. 19BlueMonkey92 > Dalfab Posted messages 638 Registration date   Status Member Last intervention  
         

        Okay, thanks

        0
  2. Anonymous user
     

    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

    0
    1. [Dal] Posted messages 6122 Registration date   Status Contributor Last intervention   1 108
       

      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.

      1
      1. Anonymous user > [Dal] Posted messages 6122 Registration date   Status Contributor Last intervention  
         

        Oh yes sorry, upon waking I thought not Unicode and I wrote the opposite!

        0