build(cmake): add /utf-8 MSVC compile option to fix builds on Chinese Windows #43
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#43
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@californiaAlmonds on GitHub · 2026-11-23 13:30 UTC · original
Summary
Add
add_compile_options(/utf-8)underif(MSVC)inCMakeLists.txtso builds succeed reliably on non-UTF-8 Windows system locales — specifically Chinese versions of Windows (e.g., CP936 / GBK).Why
Without
/utf-8, MSVC interprets source files using the active Windows ANSI code page instead of UTF-8. On Chinese Windows (and other CJK / non-UTF-8 locales), UTF-8 source files containing non-ASCII characters (such as—,→,×, or UTF-8 string literals/comments) triggerC4819warnings and can cause syntax/encoding compilation errors when multi-byte sequences consume adjacent quotes or newlines.Proposed Change
In
CMakeLists.txtinside the top-levelif(MSVC)block (around lines 40–45):(Note:
clang-clalso definesMSVCin CMake and supports/utf-8, while MinGW/GCC already defaults to UTF-8.)Acceptance Criteria
add_compile_options(/utf-8)added underif(MSVC)inCMakeLists.txt0warnings) and full CTest pass on MSVC and Clang-CL CI jobsC4819or encoding-related parse errors on Chinese Windows (CP936/ GBK locale)@californiaAlmonds on GitHub · 2026-11-26 07:52 UTC · original
Fixed by PR #50 (merged to main — thanks @leonredfish!).