Skip to content

Commit 0967eb5

Browse files
committed
Update C++ unicode docs
1 parent 5a62780 commit 0967eb5

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

docs/getting-started/cpp.mdx

+22-22
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,34 @@ Get started with our cross-platform C++ header library.
44

55
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.
66

7-
0. If you are on Linux or MacOS, you'll need [ICU4C](https://icu.unicode.org/) installed. Like many other C libraries,
8-
installing the development package with your package manager (`apt`, `brew` etc) should be sufficient to make it available to compilers.
9-
The specific command you'll need is OS/Distro specific.
7+
0. Configure Unicode Support:
8+
#### Windows
9+
On Windows, to enable unicode support for this library you ***must***
10+
[configure the UTF-8 code page](https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page) via your application
11+
manifest. Failure to do so will potentially result in your application ***failing to update*** if there are any unicode characters in your user's
12+
file paths, username, etc.
13+
```xml
14+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
15+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
16+
<application>
17+
<windowsSettings>
18+
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
19+
</windowsSettings>
20+
</application>
21+
</assembly>
22+
```
23+
#### Linux & MacOS
24+
- If you are using Qt and `QString` is available, there's nothing further you need to do.
25+
- If you are not using Qt, you'll need to [install ICU4C](https://icu.unicode.org/). Like many other C libraries,
26+
installing the development package with your package manager (`apt`, `brew` etc) *should* be sufficient to make it available to compilers.
1027

1128
0. Add the `Velopack::startup()` to your entry point (eg. `main()` or `wmain()`) as early as possible, ideally the first statement to run:
1229
```cpp
1330
#include "Velopack.hpp"
1431

1532
wmain(int argc**, wchar_t *argv[ ], wchar_t *envp[ ])
1633
{
17-
// velopack may exit / restart your app at this statement
34+
// Velopack may exit / restart your app at this statement
1835
Velopack::startup(argv, argc);
1936

2037
// ... your other startup code here
@@ -31,7 +48,7 @@ The specific command you'll need is OS/Distro specific.
3148
Velopack::UpdateManagerSync manager{};
3249
manager.setUrlOrPath("https://the.place/you-host/updates");
3350

34-
std::shared_ptr<Velopack::UpdateInfo> updInfo = manager.checkForUpdates();
51+
auto updInfo = manager.checkForUpdates();
3552
if (updInfo == nullptr) {
3653
return; // no updates available
3754
}
@@ -41,23 +58,6 @@ The specific command you'll need is OS/Distro specific.
4158
}
4259
```
4360

44-
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.
45-
```xml
46-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
47-
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
48-
<application>
49-
<windowsSettings>
50-
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
51-
</windowsSettings>
52-
</application>
53-
</assembly>
54-
```
55-
:::warning[Enabling Unicode Support]
56-
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.
57-
On Windows, Velopack will use the `A` (ansi) windows functions which accept `char*` rather than the `W` (UTF-16) unicode functions.
58-
By adding the UTF-8 code page to your application manifest, the `A` ansi functions will switch to accepting UTF-8.
59-
:::
60-
6161
0. Install the `vpk` command line tool:
6262
```sh
6363
dotnet tool update -g vpk

src/css/custom.css

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
--ifm-navbar-search-input-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' class='DocSearch-Search-Icon' viewBox='0 0 20 20'%3E%3Cpath d='M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z' stroke='white' fill='none' fill-rule='evenodd' stroke-linecap='round' stroke-linejoin='round'%3E%3C/path%3E%3C/svg%3E");
3737
}
3838

39+
h4 {
40+
text-decoration: underline;
41+
}
42+
3943
.navbar__search-input {
4044
border: 1px solid #DADDE1;
4145
height: 40px;

0 commit comments

Comments
 (0)