fix(client): Windows main.cpp 用 ASCII 十六进制转义写标题,修复 C4819
v1.0.14 Windows 构建失败:main.cpp 含中文(u8 标题+中文注释),MSVC 在 GBK(936) 代码页报 C4819「字符无法表示」,而 runner 开了 /WX 警告即错误。 改为标题用 UTF-8 字节的 \x 十六进制转义、注释改英文,源码纯 ASCII, 运行时 MultiByteToWideChar(CP_UTF8) 解码,窗口标题仍是岩美酒库。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.14] - 2026-06-05
|
||||
## [1.0.15] - 2026-06-05
|
||||
|
||||
### 修复
|
||||
- 修复 Windows 桌面端打印卡死:打印字体由 OpenType/CFF 改为 TrueType(glyf),dart_pdf 渲染中文不再抛错(此前点「打印」后卡死)
|
||||
|
||||
@@ -29,8 +29,11 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
FlutterWindow window(project);
|
||||
Win32Window::Point origin(10, 10);
|
||||
Win32Window::Size size(1280, 720);
|
||||
// 窗口标题:用 u8 字面量 + UTF-8→UTF-16 转换,避免源码编码导致中文乱码。
|
||||
const std::string title_utf8 = u8"岩美酒库";
|
||||
// Window title as UTF-8 bytes (hex-escaped to keep this source pure ASCII and
|
||||
// avoid MSVC C4819 under GBK code page 936). Decoded to UTF-16 for Win32.
|
||||
// Bytes below are the UTF-8 encoding of the Chinese app title.
|
||||
const std::string title_utf8 =
|
||||
"\xE5\xB2\xA9\xE7\xBE\x8E\xE9\x85\x92\xE5\xBA\x93";
|
||||
int title_len = ::MultiByteToWideChar(CP_UTF8, 0, title_utf8.c_str(), -1,
|
||||
nullptr, 0);
|
||||
std::wstring window_title(title_len > 0 ? title_len - 1 : 0, L'\0');
|
||||
|
||||
Reference in New Issue
Block a user