You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
silence_msvc: UnicodeEncodeError when writing msvc_capture.log on non-UTF-8 consoles (e.g. cp932) #2010
This causes two problems on consoles whose encoding is not UTF-8 (e.g. cp932 on Japanese Windows):
The log file ends up with mixed encodings (created as UTF-8, appended as cp932).
The compiler output is read with errors="replace", which can introduce U+FFFD replacement characters. cp932 cannot encode U+FFFD, so the append raises UnicodeEncodeError. Only OSError is caught, so the exception propagates out of the SPAWN hook and aborts the build instead of falling back to the intended warning message.
Steps to reproduce
On Windows with a non-UTF-8 console encoding (e.g. Japanese Windows, cp932), build with scons silence_msvc=yes.
Have cl emit output that is not valid in the console encoding (e.g. a UTF-8 file name that cp932 cannot decode), so the errors="replace" read inserts U+FFFD into a captured line.
Writing that line to msvc_capture.log raises UnicodeEncodeError and the build fails.
Activity