fix(build): force MSVC UTF-8 source & execution charset #50
No reviewers
Labels
No labels
accessibility
bug
cross-platform
documentation
duplicate
enhancement
gdk-shims
good first issue
graphics
hardware-report
help wanted
invalid
question
shaders
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/californiaAlmonds--OpenScarlett!50
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/50/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@leonredfish on GitHub · 2026-11-24 01:21 UTC · original
leonredfish:fix/msvc-utf8-charset→main· +8 −0 · 1 files · 1 commits · merged 2026-11-26 07:52 UTCAll sources are UTF-8 without BOM and 15 files under src/ contain non-ASCII bytes. Unless /utf-8 is passed, MSVC decodes them with the host ANSI code page, so on any non-UTF-8 host (936/zh-CN, 1252/en-US, ...) we get:
87cdba6with MSVC 19.51 / ACP 936: include/openscarlett/gdk/xgameruntime_abi.h(755) src/shims/xgameruntime_shim.cpp(12422)afcd167rewrote those literals.Add /utf-8 (source + execution charset) under if(MSVC) so the build is host-locale independent. No narrow string literal carries non-ASCII text, so the execution-charset half changes no runtime behaviour, and MinGW/clang lanes are untouched.
All sources are UTF-8 without BOM and 15 files under src/ contain non-ASCII bytes. Unless /utf-8 is passed, MSVC decodes them with the host ANSI code page, so on any non-UTF-8 host (936/zh-CN, 1252/en-US, ...) we get: * C4819 warnings ("file contains a character that cannot be represented in the current code page"), which break the repo's /W4 0-warning rule. Reproduced on87cdba6with MSVC 19.51 / ACP 936: include/openscarlett/gdk/xgameruntime_abi.h(755) src/shims/xgameruntime_shim.cpp(12422) * hard errors when such a byte lands inside a string literal, e.g. C2001 "newline in string constant" for a wide literal containing an em dash -- hit locally on src/launcher/launcher_main.cpp:1591 beforeafcd167rewrote those literals. Add /utf-8 (source + execution charset) under if(MSVC) so the build is host-locale independent. No narrow string literal carries non-ASCII text, so the execution-charset half changes no runtime behaviour, and MinGW/clang lanes are untouched.@californiaAlmonds on GitHub · 2026-11-26 07:52 UTC · original
Verified cleanly in an isolated worktree on MSVC 19.44 (83/83 core/launcher/test targets built with 0 warnings under /W4 /utf-8, 3/3 CTests passing). Thank you @leonredfish for the clean fix! Merging now.