reddish
19th November 2009, 08:41
Hi all,
Is there a convenient way to put Unicode characters in a QString literal?
The best I've come up with so far is something like this:
const QChar euroSymbol(0x20ac);
const QString somestring = QString("The Euro symbol is: '") + euroSymbol + Qstring("'.");
The problem with this is that it is rather unclear, and that it cannot nicely be subjected to tr() for internationalization.
This is the one case I yearn for Java (where you can put \u escape codes in a string) although I realize Qt is not to blame for C++ shortcomings in this area.
Regards, Sidney
Is there a convenient way to put Unicode characters in a QString literal?
The best I've come up with so far is something like this:
const QChar euroSymbol(0x20ac);
const QString somestring = QString("The Euro symbol is: '") + euroSymbol + Qstring("'.");
The problem with this is that it is rather unclear, and that it cannot nicely be subjected to tr() for internationalization.
This is the one case I yearn for Java (where you can put \u escape codes in a string) although I realize Qt is not to blame for C++ shortcomings in this area.
Regards, Sidney