You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Unicode command-line argument handling in the Windows WGC native capture helper.
Motivation
Native Windows capture can fall back to browser capture when the temporary path contains non-ASCII characters, such as a Windows username written in Chinese.
The helper previously used main(char* argv[]), so the JSON configuration argument could be decoded through the system ANSI code page and corrupt Unicode file paths before Media Foundation created the output file.
Not applicable. This change only affects native Windows command-line/path handling.
Testing Guide
Use a Windows account whose %TEMP% path contains non-ASCII characters.
Start a full-screen recording with native Windows capture enabled.
Verify that recording starts without the “Native Windows capture failed to start. Falling back to browser capture.” message.
I reproduced the original fallback on Windows 10. Using an ASCII-only temporary directory allowed native capture to work, which isolated the problem to Unicode command-line/path handling.
Checklist
I have performed a self-review of my code.
I have added any necessary screenshots or videos.
I have linked related issue(s) and updated the changelog if applicable.
Summary by CodeRabbit
Bug Fixes
Improved Windows configuration handling to correctly support non-ASCII characters.
Prevented configuration parsing issues caused by character encoding differences.
Reviewing files that changed from the base of the PR and between e4a9d04 and 3d20de1.
📒 Files selected for processing: 1
electron/native/wgc-capture/src/main.cpp
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
The Windows capture program now uses wmain and converts its wide-character JSON command-line argument to UTF-8 before parsing.
Changes: Windows JSON argument encoding
Layer / File(s)
Summary
Convert and parse the command-line argument electron/native/wgc-capture/src/main.cpp
The program adds wideToUtf8, changes the entry point to wmain, and passes the converted JSON argument to parseSimpleJson. The helper returns an empty string for empty input.
The Unicode path handling fix is supported by the inspected producer, parser, and Windows build configuration.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preserving Unicode arguments for the Windows capture helper.
Description check
The description explains the problem, motivation, bug-fix scope, related issue, testing steps, and checklist status. It matches the pull request changes.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
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.
Comment @coderabbitai help to get the list of available commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix Unicode command-line argument handling in the Windows WGC native capture helper.
Motivation
Native Windows capture can fall back to browser capture when the temporary path contains non-ASCII characters, such as a Windows username written in Chinese.
The helper previously used
main(char* argv[]), so the JSON configuration argument could be decoded through the system ANSI code page and corrupt Unicode file paths before Media Foundation created the output file.Type of Change
Related Issue(s)
Follow-up to #517.
Screenshots / Video
Not applicable. This change only affects native Windows command-line/path handling.
Testing Guide
%TEMP%path contains non-ASCII characters.I reproduced the original fallback on Windows 10. Using an ASCII-only temporary directory allowed native capture to work, which isolated the problem to Unicode command-line/path handling.
Checklist
Summary by CodeRabbit