Niels Lohmann
809ace26b3
Keep writing ill-formed UTF-8 unchanged unless JSON_STRICT_BINARY_UTF8 is set
...
Throwing type_error.316 from to_cbor(), to_ubjson(), to_bjdata(), and
to_bson() by default would break code that works with 3.12.0, for example
code that stores ISO 8859-1 in a string and only writes it to a binary
format. Following the plan for 4.0.0, the check is now opt-in via the new
macro JSON_STRICT_BINARY_UTF8 (default 0), which is planned to become the
default in 4.0.0:
- abi_macros.hpp: default 0 and ABI tag _sbu8; macro_unscope.hpp undefines
it; CMake option JSON_StrictBinaryUTF8; ABI namespace tests updated.
- binary_writer: the four writers call check_text_utf8(), which checks
only if the macro is enabled. BON8 always checks, MessagePack never.
- Tests: the strict checks move to unit-binary_utf8_strict.cpp, which
defines the macro; the per-format tests now check that the default
writes the bytes unchanged (from_X(to_X(j)) == j).
- Docs: new macro page, macro lists, CMake option, namespace tags, and the
writer/format pages describe the default and the opt-in.
Signed-off-by: Niels Lohmann <mail@nlohmann.me >
2026-10-02 08:45:32 +02:00
..
2022-08-05 19:51:39 +02:00
2026-09-24 06:55:21 +02:00
2026-09-15 20:46:37 +02:00
2026-07-04 11:13:25 +02:00
2026-06-29 22:15:18 +02:00
2025-04-05 18:54:35 +02:00
2026-09-30 20:53:56 +02:00
2022-05-01 09:41:50 +02:00
2026-09-15 20:46:37 +02:00
2025-04-05 18:54:35 +02:00
2026-09-15 20:46:37 +02:00
2022-05-01 09:41:50 +02:00
2026-09-27 20:40:13 +02:00
2022-05-01 09:41:50 +02:00
2026-09-30 20:06:51 +02:00
2026-09-30 20:07:45 +02:00
2026-09-30 20:07:45 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2022-05-17 13:08:56 +02:00
2026-06-29 22:15:18 +02:00
2026-07-26 08:29:31 +00:00
2026-07-04 11:13:25 +02:00
2026-07-04 11:13:25 +02:00
2025-05-04 10:28:24 +02:00
2025-01-17 06:53:35 +01:00
2022-05-01 09:41:50 +02:00
2026-07-04 11:13:25 +02:00
2026-06-30 18:09:06 +02:00
2024-12-09 23:02:30 +01:00
2026-09-30 20:07:45 +02:00
2025-04-05 18:54:35 +02:00
2026-07-09 17:24:19 +02:00
2026-09-27 16:56:21 +02:00
2026-09-27 16:56:21 +02:00
2026-09-27 16:56:21 +02:00
2026-09-28 17:51:07 +02:00
2026-09-28 17:51:07 +02:00
2026-09-27 16:56:21 +02:00
2025-04-05 18:54:35 +02:00
2022-05-17 13:08:56 +02:00
2026-06-29 22:15:18 +02:00
2024-12-09 23:02:30 +01:00
2024-12-06 18:38:25 +01:00
2026-09-25 18:02:38 +02:00
2026-07-09 17:24:19 +02:00
2026-09-27 16:56:21 +02:00
2026-09-27 16:56:21 +02:00
2026-09-30 20:07:16 +02:00
2026-06-29 22:15:18 +02:00
2022-05-01 09:41:50 +02:00
2025-04-05 18:54:35 +02:00
2022-05-01 09:41:50 +02:00
2026-06-29 22:15:18 +02:00
2022-05-01 09:41:50 +02:00
2025-04-05 18:54:35 +02:00
2025-04-05 18:54:35 +02:00
2025-04-05 18:54:35 +02:00
2026-06-29 22:15:18 +02:00
2022-05-01 09:41:50 +02:00
2025-04-05 18:54:35 +02:00
2022-05-01 09:41:50 +02:00
2025-04-05 18:54:35 +02:00
2026-07-10 16:01:08 +02:00
2026-09-15 20:46:37 +02:00
2026-09-15 20:46:37 +02:00
2022-07-29 14:28:37 +02:00
2026-09-30 23:04:57 +02:00
2026-06-29 22:15:18 +02:00
2026-09-15 20:46:37 +02:00
2026-09-30 22:15:20 +02:00
2026-09-30 22:15:20 +02:00
2026-09-15 20:46:37 +02:00
2026-09-15 20:46:37 +02:00
2026-07-04 11:13:25 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2024-07-07 10:22:17 +02:00
2025-04-05 18:54:35 +02:00
2024-07-07 10:22:17 +02:00
2026-07-09 20:57:41 +02:00
2022-08-05 19:51:39 +02:00
2022-05-01 09:41:50 +02:00
2026-07-04 11:13:25 +02:00
2026-09-30 20:07:06 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2026-09-30 22:15:20 +02:00
2026-06-29 22:15:18 +02:00
2026-09-30 20:07:33 +02:00
2026-09-30 20:07:48 +02:00
2026-09-09 09:49:12 +02:00
2026-09-09 09:49:12 +02:00
2026-07-04 11:13:25 +02:00
2026-06-29 22:15:18 +02:00
2026-06-29 22:15:18 +02:00
2026-09-27 16:56:21 +02:00
2022-05-01 09:41:50 +02:00
2025-01-17 06:53:35 +01:00
2026-07-09 17:24:19 +02:00
2022-07-29 14:28:37 +02:00
2026-06-29 22:15:18 +02:00
2026-09-15 20:46:37 +02:00
2026-09-30 20:07:24 +02:00
2026-10-02 08:45:32 +02:00
2026-09-27 16:56:21 +02:00
2026-10-02 08:45:32 +02:00
2026-10-02 08:45:32 +02:00
2026-09-30 20:07:19 +02:00
2026-07-04 11:13:25 +02:00
2026-10-02 08:45:32 +02:00
2026-06-29 22:15:18 +02:00
2026-07-09 17:24:19 +02:00
2022-05-01 09:41:50 +02:00
2026-09-15 20:46:37 +02:00
2026-09-30 23:04:57 +02:00
2022-08-05 19:51:39 +02:00
2026-09-30 20:07:45 +02:00