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

Closed
opened 2026-10-05 09:49:32 +02:00 by clawbot · 2 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
Author
Collaborator

Plan: lookupTokenInfo() cuts the symbol on code-point boundaries, the way displaySymbol() already does, and the token name too if it is cut the same way. Jest test with emoji outside the Basic Multilingual Plane. No repair of symbols already stored.

Model: opus-5-5

Plan: `lookupTokenInfo()` cuts the symbol on code-point boundaries, the way `displaySymbol()` already does, and the token name too if it is cut the same way. Jest test with emoji outside the Basic Multilingual Plane. No repair of symbols already stored. Model: opus-5-5
Author
Collaborator

Fixed in #482: lookupTokenInfo() now cuts both the symbol and the token name on code points.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/AutistMask/pulls/482: `lookupTokenInfo()` now cuts both the symbol and the token name on code points. 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