Skip to content

[gui] Fix non-ASCII filename rendering in TRootBrowser#22455

Open
wacfrr wants to merge 2 commits into
root-project:masterfrom
wacfrr:fix-win32-gui-utf8
Open

[gui] Fix non-ASCII filename rendering in TRootBrowser#22455
wacfrr wants to merge 2 commits into
root-project:masterfrom
wacfrr:fix-win32-gui-utf8

Conversation

@wacfrr
Copy link
Copy Markdown

@wacfrr wacfrr commented Jun 2, 2026

ROOT's application manifest explicitly declares UTF-8 active code page, so strings entering the GDK backend are guaranteed to be valid UTF-8. Use explicit UTF-8 decoding instead of mbstowcs(), which would misinterpret the UTF-8 byte stream under the system's legacy ANSI code page.

This Pull request:

Fixes non-ASCII (CJK and other) filename display in TRootBrowser on Windows.

Changes or fixes:

  • graf2d/win32gdk/gdk/src/gdk/win32/gdkim-win32.c: Replace mbstowcs with explicit UTF-8 decoding in gdk_nmbstowchar_ts, since ROOT's application manifest already declares UTF-8.

  • graf2d/win32gdk/gdk/src/gdk/win32/gdkfont-win32.c: Add font fallback to the first available font in gdk_wchar_text_handle when no exact Unicode block match is found, with defensive null checks on the font list.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR addresses #22450

ROOT's application manifest explicitly declares UTF-8 active code page,
so strings entering the GDK backend are guaranteed to be valid UTF-8.
Use explicit UTF-8 decoding instead of mbstowcs(), which would
misinterpret the UTF-8 byte stream under the system's legacy ANSI code page.
@wacfrr wacfrr requested a review from couet as a code owner June 2, 2026 13:03
Comment thread graf2d/win32gdk/gdk/src/gdk/win32/gdkfont-win32.c Outdated
Co-authored-by: ferdymercury <ferdymercury@users.noreply.github.com>
@linev linev requested review from bellenot and couet and removed request for couet June 3, 2026 08:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Test Results

    21 files      21 suites   3d 10h 49m 18s ⏱️
 3 864 tests  3 864 ✅ 0 💤 0 ❌
74 547 runs  74 547 ✅ 0 💤 0 ❌

Results for commit 073c555.

@wacfrr
Copy link
Copy Markdown
Author

wacfrr commented Jun 3, 2026

Hi, thanks for triggering the CI!

Regarding the clang-format failure on the CI, I apologize for the style discrepancy. I did try running clang-format locally before submitting, but it automatically triggered too many unintended changes . To avoid messing up the git history and keep this PR strictly focused on the essential encoding alignment, I decided to discard those global formatting changes and only modify the necessary parts.

Please let me know if you would like me to manually re-format just the newly added lines to match the project's style guide, or how we should best handle the formatting here. Thanks!

@bellenot
Copy link
Copy Markdown
Member

bellenot commented Jun 3, 2026

@wacfrr no, don't worry about the formatting. And it looks good. I'll perform some more tests and then we'll see if it's good to go

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.

3 participants