Skip to content

Commit

Permalink
wnbd-client: use utf-8
Browse files Browse the repository at this point in the history
wnbd-client doesn't currently accept unicode CLI arguments.

We'll use utf-8 instead of utf-16 for the following reasons:

* better interoperability
* the wnbd API is mostly using char* instead of wchar*
* we already require Windows >= 10.0.17134.0, so we're free to
  use the utf-8 locale
* Microsoft recommends new applications to use the utf-8 code page

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
  • Loading branch information
petrutlucian94 committed Nov 22, 2023
1 parent d26597d commit 20e029d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wnbd-client/code_page.manifest
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>
1 change: 1 addition & 0 deletions wnbd-client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

int main(int argc, const char** argv)
{
SetConsoleOutputCP(CP_UTF8);
return Client().execute(argc, argv);
}
3 changes: 3 additions & 0 deletions wnbd-client/wnbd-client.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Manifest Include="code_page.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\deps\boost.1.72.0.0\build\boost.targets" Condition="Exists('$(SolutionDir)\deps\boost.1.72.0.0\build\boost.targets')" />
Expand Down

0 comments on commit 20e029d

Please sign in to comment.