📝 clean up
This commit is contained in:
parent
e9876d9e46
commit
b167096e82
@ -28,8 +28,8 @@ and `ensure_ascii` parameters.
|
|||||||
: how to react on decoding errors; there are three possible values (see [`error_handler_t`](error_handler_t.md)):
|
: how to react on decoding errors; there are three possible values (see [`error_handler_t`](error_handler_t.md)):
|
||||||
: - `strict`: throws a [`type_error`](../../home/exceptions.md#type-errors) exception in case a decoding error occurs (this is the default),
|
: - `strict`: throws a [`type_error`](../../home/exceptions.md#type-errors) exception in case a decoding error occurs (this is the default),
|
||||||
- `replace`: replace invalid UTF-8 sequences with U+FFFD (<28> REPLACEMENT CHARACTER),
|
- `replace`: replace invalid UTF-8 sequences with U+FFFD (<28> REPLACEMENT CHARACTER),
|
||||||
- `ignore`: ignore invalid UTF-8 sequences during serialization, and
|
- `ignore`: ignore invalid UTF-8 sequences during serialization (i.e., these bytes are skipped and not copied to the output), and
|
||||||
- `keep`: keep invalid UTF-8 sequences during serialization; all bytes are copied to the output unchanged
|
- `keep`: keep invalid UTF-8 sequences during serialization (i.e., all bytes are copied to the output unchanged)
|
||||||
|
|
||||||
## Return value
|
## Return value
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ replace
|
|||||||
: replace invalid UTF-8 sequences with U+FFFD (<28> REPLACEMENT CHARACTER)
|
: replace invalid UTF-8 sequences with U+FFFD (<28> REPLACEMENT CHARACTER)
|
||||||
|
|
||||||
ignore
|
ignore
|
||||||
: ignore invalid UTF-8 sequences
|
: ignore invalid UTF-8 sequences; these bytes are skipped and not copied to the output
|
||||||
|
|
||||||
keep
|
keep
|
||||||
: keep invalid UTF-8 sequences; all bytes are copied to the output unchanged
|
: keep invalid UTF-8 sequences; all bytes are copied to the output unchanged
|
||||||
|
|||||||
@ -1000,8 +1000,11 @@ TEST_CASE("regression tests 2")
|
|||||||
{
|
{
|
||||||
nlohmann::json node;
|
nlohmann::json node;
|
||||||
node["test"] = "test\334\005";
|
node["test"] = "test\334\005";
|
||||||
const auto test_dump = node.dump(-1, ' ', false, nlohmann::json::error_handler_t::keep);
|
auto x = node.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore);
|
||||||
CHECK(test_dump == "{\"test\":\"test\334\005\"}");
|
|
||||||
|
CHECK(node.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore) == "{\"test\":\"test\\u0005\"}");
|
||||||
|
CHECK(node.dump(-1, ' ', false, nlohmann::json::error_handler_t::keep) == "{\"test\":\"test\334\005\"}");
|
||||||
|
CHECK(node.dump(-1, ' ', true, nlohmann::json::error_handler_t::keep) == "{\"test\":\"test\334\005\"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user