Yes that works for sure, but i still have a problem because in my main application I get a QNetworkReply which contains the data (with \uXXXX).
QString test = QString::fromStdWString(L"\u00fc");
To copy to clipboard, switch view to plain text mode
And this only works because your compiler does the byte conversation for you.
So in my case I get a string which contains those \uXXXX unicode characters and I convert them using a function I have wrote which works pretty simple:
- Get the hex value
- Use QByteArray::fromHex()
- Replace \uXXXX with the byte array
This method works for German umlauts and some more things but the problem is it does not work with the cyrillic alphabet and now I really don't know what to do there:
Here is a snippet :
bool buni = strReply.indexOf("\\u");
if (buni) {
do
{
int idx = strReply.indexOf("\\u");
hex.replace("0", "");
strReply.replace(idx, 6, hex);
} while (strReply.contains("\\u"));
}
[...]
QByteArray strReply = m_pSearchReply->readAll();
bool buni = strReply.indexOf("\\u");
if (buni) {
do
{
int idx = strReply.indexOf("\\u");
QByteArray hex = strReply.mid(idx+2, 4);
hex.replace("0", "");
hex = QByteArray::fromHex(hex);
strReply.replace(idx, 6, hex);
} while (strReply.contains("\\u"));
}
[...]
To copy to clipboard, switch view to plain text mode
So anyones now what I am doing wrong with the unicode character sets?
Bookmarks