Skip to content

Fix/protocol utf8 truncation#238

Open
amirmalekian wants to merge 4 commits into
sartoopjj:mainfrom
amirmalekian:fix/protocol-utf8-truncation
Open

Fix/protocol utf8 truncation#238
amirmalekian wants to merge 4 commits into
sartoopjj:mainfrom
amirmalekian:fix/protocol-utf8-truncation

Conversation

@amirmalekian

Copy link
Copy Markdown

Implement a truncateUTF8Bytes helper function to ensure that string
truncation occurs at valid UTF-8 rune boundaries. Previously, the
protocol truncated strings by byte index, which could result in
invalid UTF-8 sequences if a multi-byte character was split.

This change affects:

  • Metadata channel name serialization
  • Title data encoding for names and titles

Replace naive byte-level slicing with truncateUTF8Bytes when
encoding profile picture bundles. This prevents splitting multi-byte
characters at the 255-byte boundary, which previously caused
invalid UTF-8 sequences in the protocol.

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.

1 participant