Skip to content

Commit e1eb3fd

Browse files
Fix Windows build on non-UTF-8 locales (/utf-8 template + serious_python 4.3.3) (#6687)
* Bump serious_python to 4.3.3 in build template serious_python 4.3.3 fixes `flet build windows` failing on non-UTF-8 system locales (e.g. code page 936/GBK on Simplified-Chinese Windows) with warning C4819 escalated to error C2220 while compiling the Windows plugin. Pin the build template to it and add a 0.86.1 changelog entry. Fixes #6686 * Compile Windows plugins with /utf-8 in build template The build template compiles every plugin (and the runner) with /WX, so any plugin whose Windows source contains a non-ASCII byte fails with C4819 -> C2220 on non-UTF-8 system locales (e.g. code page 936/GBK on Simplified-Chinese Windows). This hits third-party plugins flet can't patch (reported for connectivity_plus, in addition to serious_python). Add /utf-8 to APPLY_STANDARD_SETTINGS so all targets read sources as UTF-8 regardless of the build machine's code page. Fixes #6686
1 parent fe6ff19 commit e1eb3fd

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Bug fixes
88

9+
* Fix `flet build windows` failing on non-UTF-8 system locales (e.g. Simplified-Chinese Windows, code page 936/GBK) with `warning C4819` escalated to `error C2220` while compiling a plugin's Windows sources. A non-ASCII character in a plugin source (e.g. an em dash in a comment) couldn't be decoded under the system code page, and the build template's `/WX` (warnings-as-errors) turned it fatal. The Windows build template now compiles all targets with `/utf-8`, so every plugin — including third-party ones flet doesn't control (e.g. `connectivity_plus`) — reads its sources as UTF-8 regardless of the build machine's code page. Also bumps `serious_python` to 4.3.3, which removes the character from its own plugin at the source ([#6686](https://github.com/flet-dev/flet/issues/6686)) by @FeodorFitsner.
910
* Fix the cryptic `shutil.ReadError: ... is not a zip file` failure in web apps when the app package download fails. The Pyodide worker piped the `pyfetch(app_package_url)` response straight into `unpack_archive()` without a status check, so any non-2xx response (transient server 500, expired auth 401, deleted app 404) wrote the JSON/HTML error body to a temp file and crashed while unpacking it. The worker now checks `response.ok` and raises a readable `Failed to download app package: HTTP <status> <url> — <body>` error, including the first 200 chars of the error body. Applied to both the Flet web client and the `flet build` template ([#6680](https://github.com/flet-dev/flet/pull/6680)) by @FeodorFitsner.
1011
* Remove unused `BasePage` return type and import from `BaseControl` and `ControlEvent` ([#6606](https://github.com/flet-dev/flet/pull/6606)) by @Iaw4tch.
1112
* Fix `GestureDetector.allowed_devices` crashing with `type 'List<dynamic>' is not a subtype of type 'List<String?>?'` and preventing the control from rendering. Property values are deserialized from JSON as `List<dynamic>`, but the value was read via `get<List<String?>>(...)`, whose reified cast fails because a `List<dynamic>` is not a `List<String?>`. It's now read as `List<dynamic>` and each entry is converted to a string before parsing, restoring `supportedDevices` filtering for Flutter's `GestureDetector` ([#6684](https://github.com/flet-dev/flet/pull/6684)) by @TURBODRIVER.

sdk/python/templates/build/{{cookiecutter.out_dir}}/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
flet:
1919
path: ../../../../../packages/flet
2020

21-
serious_python: 4.3.2
21+
serious_python: 4.3.3
2222

2323
# MsgPack codec used by the dart_bridge FletBackendChannel implementation
2424
# in lib/main.dart — matches the wire format flet's existing socket

sdk/python/templates/build/{{cookiecutter.out_dir}}/windows/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ add_definitions(-DUNICODE -D_UNICODE)
4040
function(APPLY_STANDARD_SETTINGS TARGET)
4141
target_compile_features(${TARGET} PUBLIC cxx_std_17)
4242
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43+
# Read source files as UTF-8 regardless of the build machine's system code
44+
# page. Without this, a non-ASCII byte in any plugin's source (e.g. an em
45+
# dash in a comment) triggers warning C4819 on non-UTF-8 locales — notably
46+
# code page 936/GBK on Simplified-Chinese Windows — which the /WX above
47+
# escalates to a fatal C2220. This applies to every plugin and the runner,
48+
# including third-party plugins we don't control (flet-dev/flet#6686).
49+
target_compile_options(${TARGET} PRIVATE /utf-8)
4350
target_compile_options(${TARGET} PRIVATE /EHsc)
4451
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
4552
target_compile_definitions(${TARGET} PRIVATE "_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS")

0 commit comments

Comments
 (0)