Cannot open generated .pro (qtcreator) file on Windows due to UTF8-BOM

When generating a qmake project file (.pro) to edit unreal engine source code with qt creator:

GenerateProjectFiles.bat -qmakefile

It generates .pro and .pri files with UTF8 BOM encoding, qt creator on windows complains it cannot handle BOM and won’t load the project properly.

You can either convert your files to UTF8 without BOM each time you generate the project files (that’s annoying)

Or modify unreal build tool to be sure it will always output files without BOM:

UE\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\QMake\QMakefileGenerator.cs

Locate the function WriteFileIfChanged() there should be calls to File.WriteAllText() inside. Be sure to replace new UTF8Encoding() and Encoding.UTF8 with new UTF8Encoding(false) to force encoding without BOM.