-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows CLI arguments use either ANSI (main()) or UTF-16 (wmain()). Meanwhile, Ceph libraries expect UTF-8 and raise exceptions when trying to use Unicode CLI arguments or log Unicode output: rbd.exe create test_unicode_șțăâ --size=32M terminate called after throwing an instance of 'std::runtime_error' what(): invalid utf8 We'll use a Windows application manifest, setting the "activeCodePage" property [1][2]. This enables the Windows UCRT UTF-8 mode so that functions that receive char* arguments will expect UTF-8 instead of ANSI, including main(). One exception is CreateProcess, which will need the UTF-16 form (CreateProcessW). Despite the locale being set to utf-8, we'll have to explicitly set the console output to utf-8 using SetConsoleOutputCP(CP_UTF8). In order to use the UTF-8 locale, we'll have to switch the mingw-llvm runtime from msvcrt to ucrt. This also fixes ceph-dokan crashes that currently occur when non-ANSI paths are logged. [1] https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#activecodepage [2] https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page Signed-off-by: Lucian Petrut <[email protected]>
- Loading branch information
1 parent
e877333
commit 750a948
Showing
13 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<application> | ||
<windowsSettings> | ||
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage> | ||
</windowsSettings> | ||
</application> | ||
</assembly> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <winuser.h> | ||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "code_page.manifest" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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