-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Support for Strings Containing \0
Characters
#895
Comments
A |
You're correct that within a JSON string value, the range of valid raw, unescaped UTF-8-encoded code points starts from U+0020 and ends with U+10FFFF (inclusive), but excludes U+0022 and U+005C ( The only valid encoding of U+0000 is |
Thank you for maintaining cJSON, it has been very helpful in many of our projects!
However, I’ve encountered a limitation regarding how strings are handled within the library. As the documentation mentions, cJSON currently doesn't support strings that contain null characters (\0) because it relies on null-terminated strings.
This limitation makes it difficult to work with data that contains embedded null characters, especially when dealing with binary data or certain encodings. I understand that this might be a fundamental design choice due to how strings are managed in C, but I was wondering:
Are there any plans to support strings with null characters (\0) in future versions of cJSON?
If not, would there be any recommended approaches for handling such data within cJSON?
Having the ability to handle these strings, possibly through a function that allows specifying the string length explicitly (similar to strncpy), would greatly expand the library’s utility in various use cases where binary data is involved.
Thanks in advance for considering this request, and I look forward to your response!
Best regards
The text was updated successfully, but these errors were encountered: