diff options
author | Lucian Petrut <lpetrut@cloudbasesolutions.com> | 2023-08-18 14:25:52 +0200 |
---|---|---|
committer | Lucian Petrut <lpetrut@cloudbasesolutions.com> | 2023-11-22 10:14:49 +0100 |
commit | 750a9483d169bdc10ab6865492b9e399e40bc20c (patch) | |
tree | 5b181a616ed1dd35861c0feaf92b24236c9de29c /win32_deps_build.sh | |
parent | Merge pull request #54566 from badone/wip-python-version-fedora-39 (diff) | |
download | ceph-750a9483d169bdc10ab6865492b9e399e40bc20c.tar.xz ceph-750a9483d169bdc10ab6865492b9e399e40bc20c.zip |
common: Windows Unicode CLI support
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 <lpetrut@cloudbasesolutions.com>
Diffstat (limited to 'win32_deps_build.sh')
-rwxr-xr-x | win32_deps_build.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/win32_deps_build.sh b/win32_deps_build.sh index 6eea81d1b8a..c61cd7cb78a 100755 --- a/win32_deps_build.sh +++ b/win32_deps_build.sh @@ -40,8 +40,8 @@ dokanTag="v2.0.5.1000" dokanSrcDir="${depsSrcDir}/dokany" dokanLibDir="${depsToolsetDir}/dokany/lib" -mingwLlvmUrl="https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-msvcrt-ubuntu-18.04-x86_64.tar.xz" -mingwLlvmSha256Sum="bc97745e702fb9e8f2a16f7d09dd5061ceeef16554dd12e542f619ce937e8d7a" +mingwLlvmUrl="https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz" +mingwLlvmSha256Sum="bc367753dea829d219be32e2e64e2d15d03158ce8e700ae5210ca3d78e6a07ea" mingwLlvmDir="${DEPS_DIR}/mingw-llvm" function _make() { |