Skip to content

fix(windows): preserve Unicode workspace picker paths - #619

Open
jackie-cqz wants to merge 1 commit into
anywhere-labs:masterfrom
jackie-cqz:fix/522-windows-unicode-picker
Open

fix(windows): preserve Unicode workspace picker paths#619
jackie-cqz wants to merge 1 commit into
anywhere-labs:masterfrom
jackie-cqz:fix/522-windows-unicode-picker

Conversation

@jackie-cqz

Copy link
Copy Markdown

Fixes #522.

Supersedes #616 after renaming the source branch to match the fix/ convention.

Summary

  • keep Electron dialog.showOpenDialog as the normal Windows workspace picker
  • detect the affected boundary when Electron returns a non-ASCII path that does not exist
  • retry through an isolated PowerShell/WinForms folder picker
  • carry the selected path as UTF-16LE Base64 so the active Windows console code page cannot corrupt it
  • keep using the Unicode-safe picker for later selections in the same Desktop runtime

No upstream submodule files are changed, and the fix does not attempt to guess or reverse mojibake.

Flow

flowchart LR
  Electron[Electron folder picker] --> Check{Selected path exists?}
  Check -->|yes| Workspace[Workspace admission]
  Check -->|no, non-ASCII| Fallback[PowerShell / WinForms picker]
  Fallback --> Carrier[UTF-16LE Base64 carrier]
  Carrier --> Workspace
Loading

Reproduction evidence

The screenshots from #522 show 迅雷下载 becoming Ѹ������ before workspace realpath and then failing with ENOENT:

Windows folder picker selecting the Chinese directory

Workspace create failure with the corrupted path

The fallback was manually verified on Windows with both PowerShell 7 and the built-in Windows PowerShell 5.1. Both returned the exact path:

C:\测试\迅雷下载

Verification

  • corepack yarn workspace dsh-plugin-desktop test tests/workspace-admission.spec.ts tests/windows-unicode-directory-picker.spec.ts tests/electron-runtime.spec.ts — 72 passed
  • corepack yarn workspace dsh-plugin-desktop typecheck — passed
  • corepack yarn workspace dsh-plugin-desktop build — passed
  • corepack yarn workspace dsh-plugin-desktop verify:closure — 201-node runtime graph passed
  • manual Unicode selection with PowerShell 7 — passed
  • manual Unicode selection with Windows PowerShell 5.1 — passed

A local full-suite run completed with 777 passed and 9 skipped. Seven existing symlink-fixture cases could not run because this Windows session lacks the CreateSymbolicLink privilege; the focused and Electron runtime suites pass.

@JunkaiWang-TheoPhy JunkaiWang-TheoPhy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the Unicode picker fallback against #522. The implementation keeps the normal Electron picker, detects inaccessible non-ASCII results, falls back to an isolated PowerShell/WinForms picker, carries the path through an ASCII Base64 UTF-16LE channel, and reuses the Unicode-safe picker afterward. Local focused tests: 72 passed; typecheck, build, and runtime-closure verification passed. CI is being run separately before merge.

@JunkaiWang-TheoPhy

Copy link
Copy Markdown
Collaborator

Code review approved. I verified the focused Windows Unicode/workspace/Electron tests (72 passed), Desktop typecheck, build, and runtime-closure locally. The repository has not created a CI run for this fork PR yet; please approve/run the fork workflow from the PR page (or ask a maintainer to do so). I will recheck the required CI results before merge.

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] 选择工作区路径出现中文字符编码转译乱码

2 participants