[BUG] Panic when handling Korean (UTF-8) characters in file/folder names
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code panics when processing HTML files containing Korean text. The Rust code attempts to
slice a UTF-8 string at a byte index that falls in the middle of a multi-byte Korean character.
Error Message:
thread '' panicked at
/rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:
byte index 12 is not a char boundary; it is inside '드' (bytes 10..13) of 수 가이드
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
The string 수 가이드 is part of 필수 가이드 (Korean text meaning "essential guide"). The
panic occurs because byte index 12 falls inside the character '드' which occupies bytes 10-13.
What Should Happen?
Claude Code should correctly handle UTF-8 multi-byte characters (Korean, Chinese, Japanese,
etc.) in file contents without panicking. String slicing should use character boundaries, not
raw byte indices.
Error Messages/Logs
thread '<unnamed>' panicked at
/rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:
byte index 12 is not a char boundary; it is inside '드' (bytes 10..13) of `수 가이드`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Steps to Reproduce
- Create an HTML file with Korean text in meta tags:
```html
<meta name="description" content="필수 가이드">
- Run Claude Code in the project directory
- Perform any operation that causes Claude Code to process/read the HTML file
- Panic occurs during string processing
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.4
Platform
Other
Operating System
Windows
Terminal/Shell
Terminal.app (macOS)
Additional Information
Root Cause Analysis:
Korean characters use 3 bytes each in UTF-8 encoding. The code appears to use byte indexing
instead of character-aware indexing when slicing strings, which causes a panic when the index
falls in the middle of a multi-byte character.
Affected text: 필수 가이드 (in HTML meta description tag)
- '필' = bytes 0-2
- '수' = bytes 3-5
- ' ' = byte 6
- '가' = bytes 7-9
- '이' = bytes 10-12
- '드' = bytes 13-15
Byte index 12 is inside '이', not '드' as shown in error - the error message itself may be
truncating the string incorrectly.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗