Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Emojis instead of ascii characters in the debug window

I think I’ve changed the console language from ASCII to unicode and now when I run a code that goes like c = ‘A’+1; it spits out emojis. (c being a char character)

I once clicked on something, I did not know what it meant but I have no idea how to search for a fix now and I’ve been looking for one for the past 3 hrs…
code example:

#include <iostream>
using namespace std;
int n, i, j;
char a[22][22];
int main() {
for (i = 0; i < 5; i++)
    for (j = 0; j < 5; j++)
        if (i == j)
            a[i][j] = 'A';
        else
            if (i < j)
                a[i][j] = a[i][j] + 1;
            else
                a[i][j] = a[i - 1][j + 4];

for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++)
        cout << a[i][j] << ' ';
    cout << endl;
}
return 0;
}

output

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

A ☺ ☺ ☺ ☺
☺ A ☺ ☺ ☺
☺  A ☺ ☺
☺   A ☺
☺    A

>Solution :

It sounds like you have changed the character encoding of your console to Unicode, which is allowing the program to interpret certain characters as emojis. To fix this, you can try changing the character encoding back to ASCII or modifying your code to handle Unicode characters. It’s also possible that you will have to change the font of your console to support the display of the characters.
In Visual Studio, you can change the character encoding of your console by following these steps:

  1. Open the project that you want to change the character encoding.
  2. Right-click on the project in the Solution Explorer and select
    Properties.
  3. In the Properties window, navigate to Configuration Properties >
    General.
  4. Under Character Set, select either "Use Unicode Character Set" or
    "Use Multi-Byte Character Set"

It’s also important to note that you will have to make sure that your font supports the selected character set.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading