How to change QString(x***....) to Chinese ?
-
think this could help you: https://doc.qt.io/qt-5/qtlinguist-hellotr-example.html and this https://doc.qt.io/qt-5/i18n-source-translation.html
you will need to load your desired locale and use tr() for all your translated strings.
Hope it helps.
-
@sonichy
You should know what text codec is it, then useQTextCodec
functions to convert (in this case I think it is GBK).
Or you can simply tryQString::fromLocal8Bit
if the system locale codec is GBK.
But why there is aë
in a Chinese string? I'm not sure it can be displayed. -
@sonichy
yes, the conversion should be from a byte array or char*.
If you test withQString::fromLocal8Bit("\xc0\xcfë\xcc\xd2U\xc5\xcc")
with GBK as the system locale, you'll succesfully get a Chinese string except that "
ë
".
But I'm not sure what encoding is your QString using.
Where do you get that output of "\xc0\xcfë\xcc\xd2U\xc5\xcc"?
From qDebug() or other?
And what is the size of this QString? 8 or 5?
Also the result from QStorageInfo::name() should usually already be unicode and don't need to be converted.
What's the output ofqDebug() << storage.name()
then?