Skip to content

Commit c6c95dc

Browse files
committed
fix: set UTF-8 input encoding for Windows stdin reading
On Windows systems with a non-UTF-8 system codepage, [Console]::In.ReadToEnd() decodes UTF-8 stdin using the system codepage instead of UTF-8. This corrupts non-ASCII characters and breaks JSON parsing for hooks that receive non-ASCII data (e.g. PreToolUse with AskUserQuestion containing non-English text). Fix: set [Console]::InputEncoding to UTF-8 before reading stdin.
1 parent dd140d4 commit c6c95dc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

scripts/install-windows.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,7 @@ $LogFile = "$ClaudeHome\logs\notifications.log"
16541654
$HookData = ""
16551655
try {
16561656
if ([Console]::IsInputRedirected) {
1657+
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
16571658
$HookData = [Console]::In.ReadToEnd()
16581659
}
16591660
} catch {

0 commit comments

Comments
 (0)