diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-02-24 09:29:41 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-25 16:05:14 +0100 |
commit | 7129ec0f476f33f32760e4b7801adaae14164444 (patch) | |
tree | 5603da1c6d304c56512c5bfb779c591724c82f1a | |
parent | 2f76a30ee18b5a7938e0c7a7be0a816f139fbc7a (diff) |
Document qPrintable encoding issues
Change-Id: I8936203afaa100ac4665ed668f7729fc8da1d445
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
-rw-r--r-- | src/corelib/global/qglobal.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index fe10c493a7..0f1968d151 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2810,12 +2810,17 @@ int qrand() The char pointer will be invalid after the statement in which qPrintable() is used. This is because the array returned by - toLocal8Bit() will fall out of scope. + QString::toLocal8Bit() will fall out of scope. Example: \snippet code/src_corelib_global_qglobal.cpp 37 + \note qDebug(), qWarning(), qCritical(), qFatal() expect %s + arguments to be UTF-8 encoded, while qPrintable() converts to + local 8-bit encoding. Therefore using qPrintable for logging + strings is only safe if the argument contains only ASCII + characters. \sa qDebug(), qWarning(), qCritical(), qFatal() */ |