deserializeJson() leaves \uXXXX instead of returning NotSupported

This commit is contained in:
Benoit Blanchon
2021-02-18 19:40:11 +01:00
parent 54d4b308f4
commit cc7ebfd11e
3 changed files with 5 additions and 4 deletions

View File

@ -5,6 +5,7 @@ HEAD
---- ----
* Removed support for `char` values, see below (issue #1498) * Removed support for `char` values, see below (issue #1498)
* `deserializeJson()` leaves `\uXXXX` unchanged instead of returning `NotSupported`
> ### BREAKING CHANGES > ### BREAKING CHANGES
> >

View File

@ -7,5 +7,6 @@ TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 0") {
DynamicJsonDocument doc(2048); DynamicJsonDocument doc(2048);
DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\"");
REQUIRE(err == DeserializationError::NotSupported); REQUIRE(err == DeserializationError::Ok);
REQUIRE(doc.as<std::string>() == "\\uD834\\uDD1E");
} }

View File

@ -384,11 +384,10 @@ class JsonDeserializer {
return false; return false;
if (codepoint.append(codeunit)) if (codepoint.append(codeunit))
Utf8::encodeCodepoint(codepoint.value(), _stringStorage); Utf8::encodeCodepoint(codepoint.value(), _stringStorage);
continue;
#else #else
_error = DeserializationError::NotSupported; _stringStorage.append('\\');
return false;
#endif #endif
continue;
} }
// replace char // replace char