Skip to content

fix(fonts): decode Windows font names as UTF-8 - #12595

Closed
dpfwpfahs1-coder wants to merge 1 commit into
stablyai:mainfrom
dpfwpfahs1-coder:agent/fix-windows-font-list-utf8
Closed

dpfwpfahs1-coder wants to merge 1 commit into
stablyai:mainfrom
dpfwpfahs1-coder:agent/fix-windows-font-list-utf8

Conversation

@dpfwpfahs1-coder

Copy link
Copy Markdown

Summary

Fixes #12590.

Windows font discovery now pins the PowerShell script's stdout to UTF-8 before it emits installed font family names. This prevents localized names such as 굴림, 휴먼명조, and G마켓 산스 Medium from becoming mojibake in the Settings font picker.

execFileText() already decodes stdout as UTF-8, but Windows PowerShell 5.1 can emit redirected text in the active console/OEM code page. The previous producer/consumer encoding mismatch corrupted non-ASCII family names. The fix makes the producer explicitly match the existing UTF-8 decoder.

The new regression test verifies both sides of the contract: the Windows script requests UTF-8 output and Korean family names survive parsing unchanged.

This is separate from #7573 (renderer-side list truncation) and #11771 / #11785 (PowerShell launch failure). It composes with #11785 because the output-encoding line is part of the shared script and works in both Windows PowerShell and PowerShell 7.

Screenshots

No visual change to the UI itself. The user-visible change is that localized entries in the existing font picker are readable.

Testing

  • pnpm lint — implementation lint, type-aware lint, reliability gates, and max-lines checks passed; the full command then stopped because upstream generated skill artifacts are stale (resources/skills/current-manifest.json, snapshot-registry.json, and release-mapping.json). This PR does not touch those files.
  • pnpm typecheck
  • pnpm test — the full repository run did not finish within 10 minutes and was terminated; no final suite result was produced.
  • pnpm build
  • Added a regression test that would fail if Windows font enumeration stops pinning UTF-8 or mangles Korean names.

Additional focused verification:

  • pnpm exec vitest run src/main/system-fonts.test.ts --config config/vitest.config.ts — 5/5 passed.
  • pnpm exec oxlint src/main/system-fonts.ts src/main/system-fonts.test.ts --deny-warnings — passed.
  • pnpm exec oxfmt --check src/main/system-fonts.ts src/main/system-fonts.test.ts — passed.
  • Real Windows PowerShell enumeration using the patched script returned 279 family names, zero Unicode replacement characters, and the Korean family 휴먼명조 intact.
  • The production build output contains the UTF-8 output-encoding assignment.

AI Review Report

The final two-file diff was reviewed for platform, runtime, performance, UI, and integration risk:

  • Cross-platform: the changed script runs only inside the existing win32 branch. macOS system_profiler and Linux fc-list behavior is unchanged.
  • Local/remote/SSH: no IPC contract, remote host behavior, SSH path, or repository operation changes. The existing font-list result and cache semantics are unchanged.
  • Agents/integrations: no agent-specific or integration-specific path is touched.
  • Performance: one constant-time encoding assignment is added before enumeration; no new process, retry, or hot-path work.
  • UI quality: no layout or component changes; only the text values supplied to the existing picker are corrected.
  • Compatibility: [System.Text.UTF8Encoding]::new($false) is supported by Windows PowerShell 5.1 and PowerShell 7.

No further code changes were needed after review.

Security Audit

  • No user-controlled input is added to the PowerShell script.
  • No command interpolation, path handling, auth, secret, dependency, or IPC surface changes.
  • The static encoding assignment does not weaken execution policy or alter process privileges.
  • No new security follow-up is required.

Notes

  • Windows-only behavior fix, reproduced and directly verified on Windows 11 with Orca 1.4.168.
  • X: not provided.

@dpfwpfahs1-coder

Copy link
Copy Markdown
Author

Verification verdict: PASS for the scoped Windows font UTF-8 fix at commit 626bbd37461eaaae4d544f0b4328f1feddab3d15.

Evidence:

  • Focused system-fonts.test.ts: 5/5 passed.
  • pnpm typecheck: passed.
  • pnpm build: passed.
  • Focused oxlint and oxfmt checks: passed.
  • Real Windows readback: 279 font families, 0 Unicode replacement characters, and 휴먼명조 preserved.
  • Built out/main/index.js contains the UTF-8 output-encoding assignment.

Root cause: Windows PowerShell could emit localized family names in a non-UTF-8 console/OEM code page while Node decoded stdout as UTF-8. The patch makes the producer match the existing decoder.

Verification limits:

  • Full pnpm lint reached the repository's stale generated skill-manifest check and stopped on three unrelated resources/skills artifacts; this PR does not change them.
  • Full pnpm test produced no final result within 10 minutes and was terminated. The directly affected test file passed.

Cross-platform and security review found no macOS/Linux behavior change, no new input or interpolation, no IPC/auth/dependency change, and negligible performance impact.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Duplicate of #12602 (fixes #12590).

Same root cause and intended fix: force Windows PowerShell font enumeration to emit UTF-8 so localized font names are not mojibake. Please continue review/landing on #12602. If this draft branch has a meaningfully different implementation detail worth cherry-picking, call it out on #12602.

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 font picker garbles localized font names without UTF-8 PowerShell output

2 participants