Quote Originally Posted by reddish View Post
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.
Well, it is not a C++ shortcoming. C++ allows the following declaration:
Qt Code:
  1. const wchar_t somestring = L"The Euro symbol is: \x20ac.";
To copy to clipboard, switch view to plain text mode 
A bit cumbersome is that, to have a Qt QString from it, you have to use the QString::fromWCharArray() function:
Qt Code:
  1. [...]->setText(QString::fromWCharArray(somestring) );
To copy to clipboard, switch view to plain text mode 
which of course cannot be put in the declaration:
Qt Code:
  1. const QString somestring = QString::fromWCharArray(L"The Euro symbol is: \x20ac."); // not legal!
To copy to clipboard, switch view to plain text mode 
A QString constructor accepting a wchar_t[] as parameter could be useful...

M.

P.S.: if the characters following the \x escape sequence could be interpreted as hex digits, the wchar_t string must be split:
Qt Code:
  1. const wchar_t somestring = L"The Euro symbol is: \x20ac" "ABCD";
To copy to clipboard, switch view to plain text mode