Commit d2f533d
fix(builtins): use char-based precision truncation in printf (#467)
## Summary
- printf string precision (`%.5s`) used byte slicing which panicked on
multi-byte UTF-8
- Changed to `chars().take(prec).collect()` for safe char-based
truncation
## Test plan
- [x] Unit test: `test_precision_multibyte_utf8`
- [x] Unit test: `test_precision_cjk`
Closes #435
Co-authored-by: Claude <noreply@anthropic.com>1 parent 87e30bb commit d2f533d
1 file changed
+30
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
164 | 167 | | |
165 | | - | |
| 168 | + | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| |||
620 | 624 | | |
621 | 625 | | |
622 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
623 | 652 | | |
0 commit comments