Introduce allow_invalid_utf16 option in Boost JSON
Fix: #940
Motivation Boost library provides parsing and serialization algorithms to transform JSON to and from the value container as needed. The current version of the boost JSON library includes an option parse_options::allow_invalid_utf8 to control the treatment of unescaped UTF-8 code units, allowing users to disable the validation of UTF-8 code points. It lacks a similar capability for dealing with invalid UTF-16 surrogate pairs. This limitation becomes apparent when users encounter scenarios involving UTF-16 encoded data with mismatched or out-of-range surrogate pairs, where the existing functionality does not provide adequate support or validation mechanisms. Therefore, extending this functionality to encompass invalid UTF-16 surrogate pairs is necessary to ensure comprehensive handling of different UTF encoding scenarios and enhance the library's robustness and versatility in parsing and serialization tasks involving UTF-16 encoded JSON data.
Design The introduction of the parse_options::allow_invalid_utf16 option grants the allowance of invalid UTF-16 surrogate pairs in strings processed by the parser. When the option is activated, the parser refrains from raising errors for invalid UTF-16 sequences. Instead, it replaces these invalid sequences with the Unicode replacement character.
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
This looks like it will affect performance, where's the profile output?
It usually appears within an hour. I'm not sure performance will be affected, given that this is a special case within a special case.
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 93.11%. Comparing base (
9f85ed6) to head (dc95216).
Additional details and impacted files
@@ Coverage Diff @@
## develop #985 +/- ##
===========================================
+ Coverage 93.08% 93.11% +0.02%
===========================================
Files 87 87
Lines 8125 8160 +35
===========================================
+ Hits 7563 7598 +35
Misses 562 562
| Files | Coverage Δ | |
|---|---|---|
| include/boost/json/basic_parser.hpp | 100.00% <ø> (ø) |
|
| include/boost/json/basic_parser_impl.hpp | 98.49% <100.00%> (+0.04%) |
:arrow_up: |
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 9f85ed6...dc95216. Read the comment docs.
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/985/pullrequest.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html
An automated preview of the documentation is available at https://985.jsondocs.prtest.cppalliance.org/libs/json/doc/html/index.html