Skip to content
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

Open
WangYihang opened this issue Oct 12, 2024 · 0 comments
Open

Feature Request: Support for Strings Containing \0 Characters #895

WangYihang opened this issue Oct 12, 2024 · 0 comments

Comments

@WangYihang
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant