I have a problem with tranformation from QString to QByteArray and then back to QString:
int main() {
QString s;
for(int i = 0; i < 65536; i++) {
s.append(QChar(i));
}
QByteArray ba = s.toUtf8();
QString s1 = QString::fromUtf8(ba);
if(areSame(s, s1)) {
qDebug() << "OK";
} else {
qDebug() << "FAIL";
outputErrors(s, s1);
}
return 0;
}
As you can see I fill QString with all characters that are within 16bit range. and then convert them to QByteArray (Utf8) and back to QString. The problem is that the character with value 0 and characters with value larger than 55295 fail to convert back to QString.
If I stay within range 1 to < 55297 this test passes.