UBT Output log encoding does not match if non-ASCII characters are in the UBT output. Before UE4.23, UBT output encoding problems only exist in the editor "Compiler Log" under Developer Tools, and in external usages of UBT like "Generate Visual Studio project files". Starting from 4.23, all normal usages can cause that issue.


User has provided the following fix/work around: 

"I managed to fix this issue in my custom UE4 build. Simply do "Console.OutputEncoding = Encoding.UTF8" before outputing happens. At least in UE4's context, we expect to do "Output += FUTF8ToTCHAR((const ANSICHAR*)Buffer).Get()" in FWindowsPlatformProcess::ReadPipe() in Runtime/Core/Private/Windows/WindowsPlaltformProcess.cpp. But if the output log is not in UTF8 encoding, the texts will be displayed incorrectly unless your output has no characters conflicting with your OS locale. I don't know much about the compiler log's encodings, but I found this way solved the issue for any usage of UBT."

Steps to Reproduce
  1. Change the Operating System's language to Chinese.  You may need to reboot to apply the language change.
  2. Create a New C++ Project
  3. In Visual Studio, make a syntax compiling error. 
  4. Compile the project.


Results:  If non-ASCII characters are in the UBT output, they will be displayed abnormally (aka in bad text encoding).


Expected: The output log displays correctly. 

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-84854 in the post.

Login to Vote

ComponentDevTools - UnrealBuildTool
Affects Versions4.234.24
CreatedNov 21, 2019
UpdatedDec 10, 2019
Pull Requests
6427 - ltndkl