I think you would need to convert the 3 line to foo.toUtf8() and the 1st line implicitly coverts it to unicode. And cout STL doesn't handle unicode.
I think you would need to convert the 3 line to foo.toUtf8() and the 1st line implicitly coverts it to unicode. And cout STL doesn't handle unicode.
That could be a side effect of implicit char* to QString casts, or improper locale settings which would make QString::fromLocal8Bit() use an improper text codec.
Current Qt projects : QCodeEdit, RotiDeCode
The Qt environment manipulation functions are thread-safe, but this requires that the C library equivalent functions like getenv and putenv are not directly called.
To convert the data to a QString use QString::fromLocal8Bit().
Note: on desktop Windows, qgetenv() may produce data loss if the original string contains Unicode characters NOT representable in the ANSI encoding. Use qEnvironmentVariable() instead. On Unix systems, this function is lossless.
Link: https://doc.qt.io/qt-5/qtglobal.html#qgetenv (for more information)
Last edited by mimcimm; 23rd October 2020 at 09:13. Reason: adding link
Wow, 11 years... got to be a new record for thread resurrection![]()
Bookmarks