Skip to content

Fix MSVC C4819 encoding warnings on Windows with non-English code pages#78

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-unicode-encoding-issues
Draft

Fix MSVC C4819 encoding warnings on Windows with non-English code pages#78
Copilot wants to merge 2 commits intomainfrom
copilot/fix-unicode-encoding-issues

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 22, 2026

On Windows with code page 936 (GBK/Chinese Simplified), MSVC emits C4819 warnings for shader source files (ShaderNode.h, ShaderDataType.h, etc.) because it cannot determine the source encoding without explicit direction.

Changes

  • cmake/configuration.cmake: Add /utf-8 to MSVC compile options, instructing MSVC to treat all source files as UTF-8 (source and execution character sets)
if(MSVC)
    cmake_host_system_information(RESULT CPU_NUMBER_OF_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES)
    add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP${CPU_NUMBER_OF_LOGICAL_CORES}>)
    add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
endif()

This applies globally to all targets, eliminating C4819 warnings without suppressing them via /wd4819.

Original prompt

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ShaderNode.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/TranslationUnit.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ShaderNode.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/RHILayoutGenerator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/BufferLayoutCalculator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ResourceGroupDecl.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/TranslationUnit.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/RHILayoutGenerator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ResourceGroupDecl.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/BufferLayoutCalculator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ResourceDeclGenerator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/ResourceDeclGenerator.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderNode.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/HLSLResourceDeclGen.cpp”)

D:\Code\Engine\SkyEngine\engine\render\shader\include\shader\node\ShaderDataType.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 [D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\ShaderCompiler.Static.vcxproj]
(编译源文件“../../../../engine/render/shader/src/node/HLSLResourceDeclGen.cpp”)

ShaderCompiler.Static.vcxproj -> D:\Code\Engine\SkyEngine\cmake-build-debug-visual-studio\engine\render\shader\Debug\ShaderCompiler.Static.lib
ShaderLayoutT...

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Mar 22, 2026
Copilot AI changed the title [WIP] Fix Unicode encoding issues in shader files Fix MSVC C4819 encoding warnings on Windows with non-English code pages Mar 22, 2026
Copilot AI requested a review from bluesky013 March 22, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants