Skip to content

fix(builtins): use char count instead of byte length in expr#466

Merged
chaliy merged 1 commit intomainfrom
claude/fix-434-Y2nIj
Mar 2, 2026
Merged

fix(builtins): use char count instead of byte length in expr#466
chaliy merged 1 commit intomainfrom
claude/fix-434-Y2nIj

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Mar 2, 2026

Summary

  • expr length used len() (byte count) instead of chars().count() for multi-byte UTF-8
  • expr substr used byte-based slicing instead of char-based iteration
  • Both now use char-based operations

Test plan

  • Unit test: test_length_multibyte_utf8
  • Unit test: test_substr_multibyte_utf8

Closes #434

expr length now uses chars().count() instead of len() (byte count).
expr substr now uses char-based skip/take instead of byte slicing.
Prevents panics on multi-byte UTF-8 input.

Closes #434

https://claude.ai/code/session_01WZjYqxm5xMPAEe7FSHJkDy
@chaliy chaliy force-pushed the claude/fix-434-Y2nIj branch from 844ba23 to d435eda Compare March 2, 2026 01:31
@chaliy chaliy merged commit 87e30bb into main Mar 2, 2026
17 checks passed
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.

[M-11] expr builtin panics on multi-byte UTF-8 input (TM-UNI-015)

2 participants