microsoft/winget-cli

Work toward u8string across the project to avoid future issues when handling extended characters

Opened this issue · 12 comments

Brief description of your issue

This is a follow up issue filed with unicode fix PR #466
std::string is used across the project to represent strings. In some cases, it'll cause potential bugs when handling extended characters. For example, std::filesystem::path treats std:;string type as narrow case encoding.

Expected behavior

u8string is used across the project for representing strings. Or at least those deal with windows file systems are changed to use u8string.

I'm also hitting this when testing with winget install -m. The regular localized output of winget --info is in correct encoding, but the error output is not.
Once I changed my system-wide encoding to 65001(force UTF-8), everything gets correct.

std::u8string is a C++20 feature, so we will have to wait until we have support for it to move over.

I think I also suffer unicode issues with updating portable application on Windows with non ansi usernames (é in my Name andré and German Umlaute in Usernames like my Dad Günter). In failed update logs I see issues with usernames being different André vs ANDR~1 vs Andr├ę or André and Günter vs GNTER~1 or Günter) and this mix of.

Can all user path operations be checked and handled better?

any update on this? I have several pending portable app updates which fail because of the user name issue.

Our project has not been updated to cpp20 yet. But the portable related path issues should have been fixed with latest release. Are you still seeing the issue with latest release? If so, can you provide some repro steps so we can investigate?

Are you still seeing the issue with latest release? If so, can you provide some repro steps so we can investigate?

as said in comment above, I still have such issues with German Umlauten (Ü, Ä) and with the "é" in my username André. This still happens with latest stable 1.11.510.

repro is easy, setup Windows with accountname André, install portable apps like iperf3 and try to update them. In the verbose logs you see that the Account name is different (instead of André I see things like ANDR~1 vs Andr├ę or André). And so winget fails to get data and fails to update portable applications.

Are you still seeing the issue with latest release?

Image

Here are logs about it:

2025-10-10 06:05:36.935 [REPO] Removing portable file [C:\Users\André\AppData\Local\Microsoft\WinGet\Packages\ar51an.iPerf3_Microsoft.Winget.Source_8wekyb3d8bbwe\cygwin1.dll]
2025-10-10 06:05:36.935 [REPO] Did not find a portable file with the path  { C:\Users\André\AppData\Local\Microsoft\WinGet\Packages\ar51an.iPerf3_Microsoft.Winget.Source_8wekyb3d8bbwe\cygwin1.dll }
2025-10-10 06:05:36.936 [FAIL] 
C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\Portable_1_0\PortableIndexInterface_1_0.cpp(54)\WindowsPackageManager.dll!00007FFA6B669773: (caller: 00007FFA6B63BBEE) Exception(1) tid(29c8) 80070490 Element nicht gefunden.

Here you see the username issue:

C:\Users\André\AppData

Yes, I sent a pr to fix the issue. Thanks for raising this.

Yes, I sent a pr to fix the issue.

which version will get the fix? 1.12?

Yes, I sent a pr to fix the issue.

which version will get the fix? 1.12?

Yes, it should go into 1.12 (just under the wire).

thanks, I'll test 1.12 when it is available and report if the PR fixed it.

Yes, it should go into 1.12 (just under the wire).

works now, I can update my portable apps now fine with Windows Package Manager 1.12.340