Skip to content

fix(captions): read whisper-stt paths as UTF-8 on Windows - #1407

Merged
EtienneLescot merged 1 commit into
mainfrom
pilot/fix-1405
Oct 28, 2026
Merged

EtienneLescot merged 1 commit into
mainfrom
pilot/fix-1405

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Refs #1405

On Windows, a profile folder with non-ASCII characters (e.g. C:\Users\홍길동\) killed whisper-stt-server.exe at boot with 0xC0000409. The helper read --model and the OPENSCREEN_* variables through char** argv / getenv(), which Windows fills in the ANSI code page, while whisper.cpp converts every path as UTF-8.

Huge thanks to @pgkang0619 for the precise diagnosis and the patch this builds on.

Changes (Windows only, other platforms unchanged)

  • argv from CommandLineToArgvW(GetCommandLineW()), env from _wgetenv, both converted to UTF-8 (shell32 linked).
  • CTC aligner model (/emissions): opened with _wfopen on the UTF-8 path. Not ggml_fopen: the helper links the CRT statically, so a FILE* from ggml.dll crashed on read.
  • Temp WAV for uploads kept as a std::filesystem::path, since .string() converts to ANSI and throws under a non-ASCII TEMP.
  • Node side unchanged: spawn already passes UTF-16 arguments.

Proof (CPU build, model + VAD + CTC model and TEMP under the test folder, short LibriSpeech clip)

Folder main this branch
%TEMP%\Café exits 0xC0000409 at boot ready, /inference 200 with the right text, /emissions 200
%TEMP%\홍길동 exits 3, path read as ??? ready, /inference 200, /emissions 200
ASCII folder works works

Not covered: the Vulkan build, macOS and Linux (code path unchanged there), a real Korean-locale Windows.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved Windows support for file paths and command-line input containing non-English characters.
    • Fixed handling of model and audio file paths so these files can be opened more reliably when their names include Unicode characters.

The helper read --model, --vad-model and the OPENSCREEN_* variables through
char** argv and getenv(), which Windows hands over in the ANSI code page.
whisper.cpp converts every path as UTF-8, so a model under a non-ASCII
profile folder crashed the boot with 0xC0000409. Read the wide command line
and environment instead, open the CTC model and the temp WAV through wide
paths too.

Refs #1405
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 00e70364-8293-4b95-b5d0-57fad53de744
Commits

Reviewing files that changed from the base of the PR and between 06bd7f2 and 60048aa.

Files selected for processing: 3
  • electron/native/whisper-stt/CMakeLists.txt
  • electron/native/whisper-stt/src/ctc_aligner.cpp
  • electron/native/whisper-stt/src/main.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The whisper-stt server now converts Windows arguments and environment values to UTF-8. WAV and model file handling uses filesystem paths and Windows wide-character file opening. Non-Windows argument and file-opening behavior remains in place.

Changes: Windows UTF-8 path handling

Layer / File(s) Summary
Windows arguments and environment handling
electron/native/whisper-stt/src/main.cpp, electron/native/whisper-stt/CMakeLists.txt
Windows arguments and environment values use wide-character APIs and UTF-8 conversion. Argument parsing retains its fallback and existing precedence rules. The Windows server links with shell32.
Filesystem paths for audio and model files
electron/native/whisper-stt/src/main.cpp, electron/native/whisper-stt/src/ctc_aligner.cpp
WAV paths use std::filesystem::path, and Windows model-file loading converts UTF-8 paths before opening them with _wfopen. WAV open-failure messages report the filename.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • getopenscreen/openscreen#1405 describes a Windows captions-helper failure with non-ASCII user profile paths. This change adds UTF-8 argument and environment handling and wide-character file APIs for that path scenario.

Suggested reviewers: cybersparkx

Merge Risk: Minimal · up to 60048

The Windows path changes are consistent with the model-loading interfaces inspected. No merge-blocking issue was identified; normal build and platform checks remain appropriate.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description provides a detailed summary, issue reference, implementation details, and testing results. However, it omits the required Summary, Type of change, Release impact, and Desktop impact se… Add the required template sections. Mark Bug fix, Patch, and Windows. Retain the existing testing details and issue reference. State whether screenshots are not applicable if needed.
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: fixing UTF-8 path handling for captions on Windows.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description provides a detailed summary, issue reference, implementation details, and testing results. However, it omits the required Summary, Type of change, Release impact, and Desktop impact sections, and it does not select the applicable checkboxes.

Resolution

Add the required template sections. Mark Bug fix, Patch, and Windows. Retain the existing testing details and issue reference. State whether screenshots are not applicable if needed.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot
EtienneLescot merged commit 079ee05 into main Oct 28, 2026
24 of 25 checks passed
@EtienneLescot
EtienneLescot deleted the pilot/fix-1405 branch October 28, 2026 18:40
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.

1 participant