From 4d2bf663ebca19402fda5527535b93d5cdde6e27 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Mar 2013 15:06:33 +0100 Subject: [PATCH] interpret format argument of QString::sprintf() as UTF-8 we expect our source code to be utf-8 throughout, so it doesn't make sense to expect the specifier to be latin-1, as that limits the effective charset to ascii. Change-Id: I22335509ba6c5805d8b264cfd01d7f9a4cf7ef76 Reviewed-by: Lars Knoll --- src/corelib/tools/qstring.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 75ef07a96e..eb8750838b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5461,8 +5461,10 @@ QString &QString::vsprintf(const char* cformat, va_list ap) const char *c = cformat; for (;;) { // Copy non-escape chars to result + const char *cb = c; while (*c != '\0' && *c != '%') - result.append(QLatin1Char(*c++)); + c++; + result.append(QString::fromUtf8(cb, (int)(c - cb))); if (*c == '\0') break;