#2867·sccache

MSVC response files are decoded as windows-1252 regardless of system codepage

Author: beruCreated Sep 19, 2026Updated Sep 20, 2026

read_text in src/compiler/msvc.rs decodes @-files with encoding_rs::WINDOWS_1252 on every platform. cl.exe reads them in the system ANSI codepage. On a Japanese install a response file containing -I comes back naming a directory that does not exist, and the compile fails with C1083 under sccache while succeeding without it.

The doc comment above it describes BOM-aware decoding that the function does not implement, and the has_error branch is unreachable because encoding_rs maps all 256 windows-1252 bytes.

Correction: the struck sentence was wrong on both counts. encoding_rs's Encoding::decode() does sniff a byte order mark and decode in the encoding it names, so the doc comment is accurate, test_responsefile_encoding_utf16le passes for a real reason, and the has_error branch is reachable for a marked file. The bug is only the fallback when there is no mark: that is windows-1252 regardless of the system ANSI codepage. Testcase in the comment below.

Generated with Claude Code