add unicode escapes support

This commit is contained in:
MihailRis
2024-10-28 12:51:16 +03:00
parent 8dac3ffdac
commit 65f9caec87
2 changed files with 18 additions and 1 deletions
+7
View File
@@ -360,6 +360,13 @@ std::string BasicParser::parseString(char quote, bool closeRequired) {
ss << (char)parseSimpleInt(8);
continue;
}
if (c == 'u') {
int codepoint = parseSimpleInt(16);
ubyte bytes[4];
int size = util::encode_utf8(codepoint, bytes);
ss.write(reinterpret_cast<char*>(bytes), size);
continue;
}
switch (c) {
case 'n': ss << '\n'; break;
case 'r': ss << '\r'; break;