Change-Id: I63a7cd3a571fb47c97157bcb2ca29c4239c600ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
if (digit >= '0' && digit <= '9')
*result |= (digit - '0');
else if (digit >= 'a' && digit <= 'f')
- *result |= (digit - 'a');
+ *result |= (digit - 'a') + 10;
else if (digit >= 'A' && digit <= 'F')
- *result |= (digit - 'A');
+ *result |= (digit - 'A') + 10;
else
return false;
return true;
void testCompaction();
void testDebugStream();
void testCompactionError();
+
+ void parseUnicodeEscapes();
private:
QString testDataDir;
};
}
}
+void TestQtJson::parseUnicodeEscapes()
+{
+ const QByteArray json = "[ \"A\\u00e4\\u00C4\" ]";
+
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QJsonArray array = doc.array();
+
+ QString result = QLatin1String("A");
+ result += QChar(0xe4);
+ result += QChar(0xc4);
+
+ QCOMPARE(array.first().toString(), result);
+}
+
QTEST_MAIN(TestQtJson)
#include "tst_qtjson.moc"