-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.15.10, 6.3.1
-
Ubuntu 22.04, GCC 11.2.0
Code
const char *rawBytes = u8"你好世界!"; int nChars = 5; QString str = QString::asprintf("%-*.*s", nChars, nChars, rawBytes); qDebug().noquote() << rawBytes; qDebug().noquote() << str; qDebug().noquote() << QByteArray(rawBytes).toHex(' '); qDebug().noquote() << str.toUtf8().toHex(' ');
Output for Qt 5.15.2 (expected)
你好世界! 你好世界! e4 bd a0 e5 a5 bd e4 b8 96 e7 95 8c ef bc 81 e4 bd a0 e5 a5 bd e4 b8 96 e7 95 8c ef bc 81
Output for Qt 5.15.10 and 6.3.1 (unexpected)
你好世界! 你�� e4 bd a0 e5 a5 bd e4 b8 96 e7 95 8c ef bc 81 e4 bd a0 ef bf bd ef bf bd 20 20