Skip to content

fix: constrain identity bytes to single characters#338

Open
achingbrain wants to merge 2 commits into
masterfrom
fix/constrain-identity-bytes
Open

fix: constrain identity bytes to single characters#338
achingbrain wants to merge 2 commits into
masterfrom
fix/constrain-identity-bytes

Conversation

@achingbrain
Copy link
Copy Markdown
Member

Use the char code API to interpret bytes as single characters to instead of lossy utf-8 conversion.

Fixes: #122

Use the char code API to interpret bytes as single characters to instead of lossy utf-8 conversion.

Fixes: #122
@achingbrain achingbrain requested a review from rvagg May 16, 2026 07:04
Copy link
Copy Markdown
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine but the encode could be made quite a bit quicker, see https://github.com/rvagg/cborg/blob/94b4c14137b67ad15e6c864009775408e28a31a9/lib/byte-utils.js#L295-L320 for dealing with exactly this, decoding via String.fromCharCode.apply(null, b) in chunks.

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

Successfully merging this pull request may close these issues.

Identity encoding decoding doesn't produce the same data

2 participants