Skip to content

Commit b89e1f5

Browse files
Fix json invalid utf-8 from IconPath (#13340)
When storing the IconPath value directly as a string we are subject to unspecified behaviour as Windows stores paths as 16-bit wchar_t and std::string doesn't convey a specific char encoding. To be specific we need to access the icon path in its native format (which we assume to be std::wstring) and convert it to multibyte.
1 parent 8106556 commit b89e1f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/windows/service/exe/LxssUserSession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ try
26832683

26842684
e["name"] = WideToMultiByte(Configuration.Name);
26852685
e["guid"] = WideToMultiByte(distributionProfileId);
2686-
e["icon"] = IconPath.string();
2686+
e["icon"] = WideToMultiByte(IconPath.native());
26872687

26882688
// See https://github.com/microsoft/terminal/pull/18195. Supported in terminal >= 1.23
26892689
e["pathTranslationStyle"] = "wsl";

0 commit comments

Comments
 (0)