From 3c881850cd71702d34e7f75c1dbbebdba98986e1 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Sun, 3 Mar 2024 17:11:26 +0000 Subject: [PATCH] Add unicode support info to C++ quick start --- docs/getting-started/cpp.mdx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/getting-started/cpp.mdx b/docs/getting-started/cpp.mdx index ba45d52..2c097b1 100644 --- a/docs/getting-started/cpp.mdx +++ b/docs/getting-started/cpp.mdx @@ -4,11 +4,11 @@ Get started with our cross-platform C++ header library. 1. Copy [Velopack.hpp](https://github.com/velopack/velopack.fusion/blob/master/for-cpp/Velopack.hpp) and [Velopack.cpp](https://github.com/velopack/velopack.fusion/blob/master/for-cpp/Velopack.cpp) into your project. -2. If you are on Linux or MacOS, you'll need [ICU4C](https://icu.unicode.org/) installed. Like many other C libraries, +0. If you are on Linux or MacOS, you'll need [ICU4C](https://icu.unicode.org/) installed. Like many other C libraries, installing the development package with your package manager (`apt` etc) is sufficient to make it available to compilers. The specific command you'll need is OS/Distro specific. -3. Add the `Velopack::startup()` to your entry point (eg. `main()` or `wmain()`) as early as possible, ideally the first statement to run: +0. Add the `Velopack::startup()` to your entry point (eg. `main()` or `wmain()`) as early as possible, ideally the first statement to run: ```cpp #include "Velopack.hpp" @@ -21,7 +21,7 @@ The specific command you'll need is OS/Distro specific. } ``` -3. Add auto-updates somewhere to your app: +0. Add auto-updates somewhere to your app: ```cpp #include "Velopack.hpp" #include @@ -41,7 +41,24 @@ The specific command you'll need is OS/Distro specific. } ``` -4. Install the `vpk` command line tool: +0. Enable the [UTF-8 codepage](https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) in your application manifest if you are targeting Windows. + ```xml + + + + + UTF-8 + + + + ``` + :::warning[Enabling Unicode Support] + The Velopack C++ Library expects UTF-8 `std::string` and `char*` strings, which is standard practice on Unix-like operating systems, so no extra steps are needed there. + On Windows, Velopack will use the `A` (ansi) windows functions which accept `char*` rather than the `W` (UTF-16) unicode functions. + By adding the UTF-8 code page to your application manifest, the `A` ansi functions will switch to accepting UTF-8. + ::: + +0. Install the `vpk` command line tool: ```sh dotnet tool update -g vpk ``` @@ -50,14 +67,14 @@ The specific command you'll need is OS/Distro specific. ::: -5. Compile your app to a program using your usual compiler (eg. msvc, cmake, gcc, etc) +0. Compile your app to a program using your usual compiler (eg. msvc, cmake, gcc, etc) -6. Copy `Vfusion.exe`, `VfusionMac` or `VfusionNix` to your build output folder. This is a manual step for now, but may be automated in the future. You can compile this yourself, download a [recent build artifact](https://github.com/velopack/velopack.fusion/actions), or grab the latest [npm release](https://www.npmjs.com/package/velopack?activeTab=code) which also bundles the binaries. +0. Copy `Vfusion.exe`, `VfusionMac` or `VfusionNix` to your build output folder. This is a manual step for now, but may be automated in the future. You can compile this yourself, download a [recent build artifact](https://github.com/velopack/velopack.fusion/actions), or grab the latest [npm release](https://www.npmjs.com/package/velopack?activeTab=code) which also bundles the binaries. :::warning Until this is automated, failing to copy the fusion binary to your update directory will result in your app being unable to update. ::: -7. Package your Velopack release / installers: +0. Package your Velopack release / installers: ```sh vpk pack -u MyAppUniqueId -v 1.0.0 -p /myBuildDir -e myexename.exe ```