Can't Package and cook the game version 4.11.2

I’ve got recently the same error. I couldn’t package my game because of a printf() on a third party plugin. But after few day we find out a simple solution to avoid the error and package or game (we are in4.26.2). Like it was said when you cook, the engine forcing stdout to UTF-8, but its an option that can be remove.

in engine code,
In MainFrameActions.cpp, in the function PackageProject
change :

FString CommandLine = FString::Printf(TEXT("-ScriptsForProject="%s" BuildCookRun %s%s -nop4 -project="%s" -cook -stage -archive -archivedirectory="%s" -package -ue4exe="%s" %s -utf8output"),

with

FString CommandLine = FString::Printf(TEXT("-ScriptsForProject="%s" BuildCookRun %s%s -nop4 -project="%s" -cook -stage -archive -archivedirectory="%s" -package -ue4exe="%s" %s"),

and in the same file, in the function CookContent, change :

FString CommandLine = FString::Printf(TEXT("-ScriptsForProject="%s" BuildCookRun %s%s -nop4 -project="%s" -cook -skipstage -ue4exe="%s" %s -utf8output"),

with

FString CommandLine = FString::Printf(TEXT("-ScriptsForProject="%s" BuildCookRun %s%s -nop4 -project="%s" -cook -skipstage -ue4exe="%s" %s"),

and
in LauncherWorker, function CreateUATCommand, change :

FString UATCommand = TEXT(" -utf8output");

with

FString UATCommand = TEXT("");

with the modification we were able to package our game.

1 Like