Hi, I'm trying to show the unicode keys to learn more about it. The char contains the unicode as follows '\u0041'. It is a QString of the following "\u0041" that I convert to char '\u0041'.Code:
char myChar = s[0].toLatin1(); // lo convierto en char
But when I put the code in the case:
switch (myChar){
//
case '\u0001': qDebug() << "aprendiendo";break;
default:break;
}
This is the error I get: a universal character name specifies an invalid character
So it is impossible to display a unicode with a char, which code should I use. I want to learn to show it with switch not with if.
Utf16 is for 2 bytes i.e. 16 bits while char is for 1 byte i.e. 8 bits. So what is the easiest way for me? I use wchar_t which is for unicode , that is to say a character that uses unicode so I define it like this:
So what I do is the following, in the switch I convert it to char so that it evaluates it and in case I use the character in unicode format:
There are other easier ways but this one works just the same.