Description
qPrintable() is defined as "str.toLocal8Bit().constData()". One of it's main uses (also documented) is actually to allow printing of QStrings in qDebug statements, e..g
qWarning("%s: %s", qPrintable(key), qPrintable(value));
However, qWarning in the end uses QString::vsnprintf() to format it's output, which - according to the documentation of QString::sprintf() - expects "UTF-8 string for %s and Latin-1 string for the format string". The QDebug::operator<< for const char * also uses QString::fromUtf8(t).
I suppose we can
- fix QDebug, qt_message to expect local 8 bit encoding for const char *.
- deprecate the use of qPrintable in combination with qDebug.
- redefine qPrintable to str.toUtf8().constData(), and break it for people using it for system printf()/cout.
Attachments
Issue Links
- resulted from
-
QTBUG-35825 qmlviewer on un-english platforms shows warnings as ???
- Closed