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.
This commit is contained in:
Carlos Nihelton 2025-08-05 15:27:20 -03:00 committed by GitHub
parent 8106556cec
commit b89e1f58c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2683,7 +2683,7 @@ try
e["name"] = WideToMultiByte(Configuration.Name);
e["guid"] = WideToMultiByte(distributionProfileId);
e["icon"] = IconPath.string();
e["icon"] = WideToMultiByte(IconPath.native());
// See https://github.com/microsoft/terminal/pull/18195. Supported in terminal >= 1.23
e["pathTranslationStyle"] = "wsl";