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 <lars.knoll@digia.com>
bb10
Oswald Buddenhagen 2013-03-07 15:06:33 +01:00 committed by The Qt Project
parent b7155b6c07
commit 4d2bf663eb
1 changed files with 3 additions and 1 deletions

View File

@ -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;