bincode icon indicating copy to clipboard operation
bincode copied to clipboard

`char` specification mismatch with implementation

Open InKryption opened this issue 7 months ago • 0 comments

char in the specification is described as being encoded as a u32: https://github.com/bincode-org/bincode/blob/55fd02934cff567ce1b2ff9d007608818ea6481b/docs/spec.md?plain=1#L58

But it appears that the actual implementation just encodes and decodes them as multi-byte UTF-8 codepoint sequences:

  • Encode: https://github.com/bincode-org/bincode/blob/55fd02934cff567ce1b2ff9d007608818ea6481b/src/enc/impls.rs#L290-L294 \/ https://github.com/bincode-org/bincode/blob/55fd02934cff567ce1b2ff9d007608818ea6481b/src/enc/impls.rs#L325-L349

  • Decode: https://github.com/bincode-org/bincode/blob/55fd02934cff567ce1b2ff9d007608818ea6481b/src/de/impls.rs#L425-L452

I assume this is a bug in the specification, and if so, it would be helpful to have it rectified.

InKryption avatar Aug 09 '25 16:08 InKryption