json icon indicating copy to clipboard operation
json copied to clipboard

Add keep parameter to dump to copy invalid UTF-8 bytes as-is

Open nlohmann opened this issue 11 months ago • 7 comments

Add an enumerator keep to error_handler_t to allow to keep the input as-is in case of UTF-8 errors.

Fixes #4552

nlohmann avatar Dec 18 '24 08:12 nlohmann

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @nlohmann Please read and follow the Contribution Guidelines.

github-actions[bot] avatar Dec 18 '24 09:12 github-actions[bot]

Coverage Status

coverage: 99.639%. remained the same when pulling 4ab98c39c3a7aa7ccd727f83f3350a0d1d44ca4c on issue4552-ignore into 663058e7d18241338aec42846d4f77995275ccf6 on develop.

coveralls avatar Dec 18 '24 09:12 coveralls

It looks good to me. I thought you would do json_string === s_kept, but you took it's substring at position 1 instead, I guess dump gives you an extra character in the beginning or something?

jordan-hoang avatar Dec 23 '24 06:12 jordan-hoang

Yes, dump adds quotes.

nlohmann avatar Dec 23 '24 06:12 nlohmann

This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!

github-actions[bot] avatar Feb 14 '25 00:02 github-actions[bot]

@nlohmann Does this still need work?

gregmarr avatar Feb 14 '25 18:02 gregmarr

Yes. And clarification.

nlohmann avatar Feb 14 '25 19:02 nlohmann