Feature Request: Support for Strings Containing `\0` Characters
维护者通常 12 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- c
调研方向
该 issue 未指定文件、测试或入口点。首先查看 cJSON 已记录的字符串处理方式和公共 API;要完成此项工作,需要就支持嵌入式 null 字符的长度感知设计达成一致,并提供相应支持。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- C
- 星标
- 13k
- 派生
- 3.5k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DaveGamble/cJSON 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
DaveGamble/cJSON#1106 ·
维护者通常 12 天内回复
-
Undefined-Behavior in function cJSON_SetNumberHelper可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
DaveGamble/cJSON#1100 · 1 个 reaction ·
维护者通常 12 天内回复
-
CMake config files contain absolute install paths可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
DaveGamble/cJSON#1094 · 9 条评论 · 1 个 reaction ·
维护者通常 12 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
DaveGamble/cJSON#1093 ·
维护者通常 12 天内回复
-
Use-after-free in cJSONUtils_ApplyPatches when a patch removes the patch array可能已有人在做 @iliasabk 于 35 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
DaveGamble/cJSON#1082 ·
维护者通常 12 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
nextbsd/nextbsd-userland#434 ·
维护者通常 1 天内回复
-
[YSQL] Local-node initdb reads postgres.bki, but YB clusters bootstrap only from yb_postgres.bki未关闭area/ysql kind/enhancement priority/low status/awaiting-triage
难度 2/5 1-3 小时 新手友好度 72/100
yugabyte/yugabyte-db#35763 ·
维护者通常 1 天内回复
-
category:port-update
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
emerge failure MARK mark-unstable media-kit
难度 2/5 1-3 小时 新手友好度 82/100
macaroni-os/mark-issues#834 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
NVIDIA/open-gpu-kernel-modules#1479 · 2 条评论 ·
维护者通常 1 天内回复