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
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:
- Open the project that you want to change the character encoding.
- Right-click on the project in the Solution Explorer and select
Properties. - In the Properties window, navigate to Configuration Properties >
General. - 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.