From 2d3e0d871e78a62944ef30637440c443277cd136 Mon Sep 17 00:00:00 2001 From: Foti Dim Date: Sun, 18 Oct 2026 11:02:35 +0200 Subject: [PATCH] Windows: compile plugin with /utf-8 (#354) --- CHANGELOG.md | 1 + windows/CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a535f99..b934416b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Bump `bluez` to `^0.9.0`. * Bump the `pigeon` dev dependency to `^29.0.0`. * Regenerate the Pigeon bindings with Pigeon 29. The async platform channels now use `@asyncCallback`, so the existing callback-based native implementations (Swift completion handlers, Kotlin callbacks) are kept as-is rather than migrated to native `async`/`suspend`. No public API change. +* Windows: compile the plugin with `/utf-8`. The Pigeon-generated sources contain UTF-8 doc comments, and MSVC decoded them using the system ANSI code page, so a clean build failed with C4819/C2220 on machines configured with a code page such as 936, 932, 949 or 950 (#354). ## 3.1.0 * `BleDevice.services` is now normalised to full 128-bit lower-case UUIDs on every platform, matching the keys of `BleDevice.serviceData`. Apple was the outlier: it reported 16-bit advertised service UUIDs in their short form (`180D`), so the same field had a different shape per platform and stored keys or comparisons did not transfer between them. Compare against, or store, the 128-bit form; short (`180D`) and `0x`-prefixed forms are still accepted as *input*. Entries that are not valid UUIDs are kept verbatim rather than dropped. diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 5c5d2f75..d09e18f4 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -63,6 +63,14 @@ add_library(${PLUGIN_NAME} SHARED apply_standard_settings(${PLUGIN_NAME}) +# Pigeon-generated sources contain UTF-8 characters in doc comments. Without +# this, MSVC decodes them using the system ANSI code page (e.g. CP936) and +# C4819 is promoted to an error by the /WX from apply_standard_settings, +# failing the plugin build on non-UTF-8 locales (#354). +if(MSVC) + target_compile_options(${PLUGIN_NAME} PRIVATE /utf-8) +endif() + # ############### NuGet import begin ################ set_target_properties(${PLUGIN_NAME} PROPERTIES VS_PROJECT_IMPORT ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT.${CPPWINRT_VERSION}/build/native/Microsoft.Windows.CppWinRT.props