dotnet / dotnet/msbuild

[msbuild][c++] Mojibakes in log if link.exe fails with error

Open
#5,063 3 comments 3 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

If I compile any c++ project with linker errors, the LINK output will looks like this:
![image](https://user-images.githubusercontent.com/10153298/72680527-b1cfd980-3ab2-11ea-8e44-12b7851e1ac5.png)

It seems that MSBuild uses UTF-16 charset for output, as LINK.EXE from C++ uses OEM charset.
It would be very cool that msbuild could at least call MultibyteCharToWideChar() API on LINK.EXE output to avoid [mojibakes](https://en.wikipedia.org/wiki/Mojibake) as they are sometimes impossible to decode (as example, if you called msbuild in Python tools like [Conan Package Manager](https://conan.io))

### Steps to reproduce
Clone the https://github.com/leha-bot/kind-of-magick example repo and follow the "vcpkg-way" build instructions in README.md as vcpkg is easier to deploy on Windows hosts (and Conan adds yet another bug layer with rendering msbuild utf-16 text as utf-8 😂 🙈 ).

### Expected behavior

The build log will contain proper text w/o mojibakes.

### Actual behavior

See screenshot above.

### Environment data
`msbuild /version` output:

```bat
Microsoft (R) Build Engine версии 16.5.0-preview-19562-03+d72e25031 для .NET Framework
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

16.5.0.56203
```
Microsoft Visual Studio 2019 with Russian language pack.

OS info:
Windows 8.1 (64-bit)
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
```bat
cmake --version
cmake version 3.16.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
```

Thank you for your work and MSBuild itself!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.