Conversation
Contributor
Author
|
@ni4 this implements the wmain/-municode direction from #2288: the production entry points take UTF-16 from the OS and convert to UTF-8 once at startup, while the test suite keeps calling rnp_main/rnpkeys_main directly. It is stacked on #2493 for the Win32 conversion helpers. Whenever convenient, a review would be appreciated. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2494 +/- ##
==========================================
+ Coverage 85.45% 85.47% +0.01%
==========================================
Files 125 125
Lines 23042 23067 +25
==========================================
+ Hits 19691 19716 +25
Misses 3351 3351 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
std::wstring_convert and std::codecvt_utf8_utf16 are deprecated as of C++17 and the Microsoft STL implementation leaks memory, as reported in issue #2302. The UTF-8/UTF-16 helpers now use MultiByteToWideChar and WideCharToMultiByte, which are the supported path on modern Windows toolchains and keep the same throwing-on-error contract the previous helpers used.
Recent MinGW builds default argv to the system ANSI code page, which is not always UTF-8, as reported in issue #2288. The production entry points now use wmain so the OS supplies UTF-16 arguments, convert them to UTF-8 once at startup, and then call the existing rnp_main / rnpkeys_main bodies. MinGW targets are linked with -municode so the Unicode entry point is selected. The rnp_main/rnpkeys_main symbols remain available for the test suite, which continues to pass UTF-8 char** arguments directly.
The wmain entry points call rnp_main and rnpkeys_main, but the forward declarations were inside the RNP_RUN_TESTS block and therefore absent from the production build, which broke compilation on every non-Windows workflow.
ronaldtse
force-pushed
the
fix-2288-wmain
branch
from
September 25, 2026 01:41
07defbc to
87ee6b3
Compare
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
rnpandrnpkeysnow enter throughwmainon Windows, so the process receives UTF-16 arguments from the OS and converts them to UTF-8 once at startup before calling the existingrnp_main/rnpkeys_mainbodies.-municodeso the Unicode entry point is selected; MSVC selectswmainautomatically when it is present.rnp_main/rnpkeys_mainsymbols remain available for the test suite, which continues to pass UTF-8char **arguments directly and does not go throughwmain.Test plan