Skip to content

Fix Windows build on non-UTF-8 locales (/utf-8 template + serious_python 4.3.3)#6687

Merged
FeodorFitsner merged 2 commits into
mainfrom
fix/bump-serious-python-4.3.3
Jul 16, 2026
Merged

Fix Windows build on non-UTF-8 locales (/utf-8 template + serious_python 4.3.3)#6687
FeodorFitsner merged 2 commits into
mainfrom
fix/bump-serious-python-4.3.3

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes flet build windows failing on non-UTF-8 system locales (e.g. Simplified-Chinese Windows, code page 936/GBK).

Problem

The build template compiles every plugin (and the runner) with /WX (warnings-as-errors). Any plugin whose Windows source contains a non-ASCII byte — e.g. an em dash in a comment — can't be decoded under a non-UTF-8 system code page, so MSVC emits C4819, which /WX escalates to a fatal C2220:

...plugin.cpp(1,1): warning C4819: The file contains a character that cannot be
  represented in the current code page (936)...
...plugin.cpp(1,1): error C2220: the following warning is treated as an error

This is not limited to one plugin. It was first reported for serious_python_windows_plugin.cpp, and after that was patched the reporter hit the same failure in connectivity_plus_plugin.cpp — a third-party plugin flet can't patch. Any plugin can trip this.

Fix

Two layers:

  1. Template-level (the real fix): add /utf-8 to APPLY_STANDARD_SETTINGS in the Windows CMakeLists template. Every plugin and the runner call this function, so all Windows sources are now read as UTF-8 regardless of the build machine's code page — covering third-party plugins (connectivity_plus, etc.) without needing an upstream fix in each.
  2. Source-level (defense in depth): bump serious_python 4.3.2 → 4.3.3, which removes the offending character from its own plugin and also compiles with /utf-8 (flet-dev/serious-python#234, released).

Plus a 0.86.1 CHANGELOG entry.

Fixes #6686

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7619abc
Status: ✅  Deploy successful!
Preview URL: https://922cf30c.flet-website-v2.pages.dev
Branch Preview URL: https://fix-bump-serious-python-4-3.flet-website-v2.pages.dev

View logs

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
@FeodorFitsner FeodorFitsner changed the title Bump serious_python to 4.3.3 (fixes Windows build on non-UTF-8 locales) Fix Windows build on non-UTF-8 locales (/utf-8 template + serious_python 4.3.3) Jul 16, 2026
@FeodorFitsner FeodorFitsner merged commit e1eb3fd into main Jul 16, 2026
38 of 58 checks passed
@FeodorFitsner FeodorFitsner deleted the fix/bump-serious-python-4.3.3 branch July 16, 2026 19:28
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.

bug: Windows build fails with C4819+C2220 error when using serious_python after upgrading Flet to 0.86

1 participant