Initialize QChar with unicode japanese character
-
Hi all
I knwo the question would be really stupid but I still didn't find a way to make that. I want to initialize a QChar with a unicode japanese character by source but I didn't get the extepctyed result.
I tried:
QChar myChar('あ');
In this case the QChar object contain a unicode character but is not the same I used for initialize. Using the other test:
QChar myChar(L'あ');
doesn't work, in this case the character seem inside the ASCII range not unicode. The cpp source file containing this code is saved in unicode without BOM format. Currently the only working way I found is the following:
QChar myChar(QString("あ").at(0));
but is really orrible. Someone know the right way to make such initialization?
Thank you -
Hi all
I knwo the question would be really stupid but I still didn't find a way to make that. I want to initialize a QChar with a unicode japanese character by source but I didn't get the extepctyed result.
I tried:
QChar myChar('あ');
In this case the QChar object contain a unicode character but is not the same I used for initialize. Using the other test:
QChar myChar(L'あ');
doesn't work, in this case the character seem inside the ASCII range not unicode. The cpp source file containing this code is saved in unicode without BOM format. Currently the only working way I found is the following:
QChar myChar(QString("あ").at(0));
but is really orrible. Someone know the right way to make such initialization?
Thank you@Suppaman
For UTF-8 you can do this:QString::fromUtf8("\u00F5");
or use it like this way
QChar(0x00F5);
Should work (Unicode values in the examples may be incorrect)