fix: a token symbol read off a contract can be stored cut in the middle of an emoji #458

Open
opened 2026-10-05 09:49:32 +02:00 by clawbot · 0 comments
Collaborator

lookupTokenInfo() in src/shared/balances.js caps a symbol read off a contract with String(symbol).slice(0, 12), which counts UTF-16 units. A symbol made of emoji outside the Basic Multilingual Plane (two units each) can be cut between the two halves of one, and the half left over is stored in trackedTokens and shown as U+FFFD on every screen that lists the token.

displaySymbol() got the same fix in #329 (it now counts code points), but it cannot repair a symbol that was already stored broken.

Definition of done

  • lookupTokenInfo() cuts a symbol on code-point boundaries, never mid-emoji.
  • A test with a symbol of emoji outside the Basic Multilingual Plane, which fails against current next.
  • make check green.

Model: opus-5-5

`lookupTokenInfo()` in `src/shared/balances.js` caps a symbol read off a contract with `String(symbol).slice(0, 12)`, which counts UTF-16 units. A symbol made of emoji outside the Basic Multilingual Plane (two units each) can be cut between the two halves of one, and the half left over is stored in `trackedTokens` and shown as U+FFFD on every screen that lists the token. `displaySymbol()` got the same fix in https://git.eeqj.de/sneak/AutistMask/issues/329 (it now counts code points), but it cannot repair a symbol that was already stored broken. ## Definition of done - [ ] `lookupTokenInfo()` cuts a symbol on code-point boundaries, never mid-emoji. - [ ] A test with a symbol of emoji outside the Basic Multilingual Plane, which fails against current `next`. - [ ] `make check` green. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#458