I've tried to execute the following code:
#include <iostream>
using namespace std;
int main() {
unsigned char datoChar = 168;
cout << datoChar << endl;
return 0;
}
And it returns a symbol with "?" but it should return "¿"
I've tried to execute the following code:
#include <iostream>
using namespace std;
int main() {
unsigned char datoChar = 168;
cout << datoChar << endl;
return 0;
}
And it returns a symbol with "?" but it should return "¿"
You have not specified on which platform you are and what the current
localeis, but its very likely that if you are running on a Unix-like operating system, the character is being interpreted by the terminal as being UTF-8 and notcp437. CP437, CP1252 and extended ASCII are nowadays mostly obsolete, and are only used in a DOS-like terminals such as Windows'scmd.exe. You may try switching to CP437 in CMD.EXE using theCHCPcommand.In UTF-8, all bytes over
0x7fare considered reserved, as they are used to implement multi-character encoding. In UTF-8, '¿' is codepoint U+00BF, and spans over two separate bytes.You may get specify it into a literal by using the hexadecimal
\uXXXXnotation, such as in