RunUAT.batを使用したCook時に、出力の2バイト文字が文字化けする

お世話になっております。

RunUAT.bat BuildCookRun を使用したCookの出力で、2バイト文字が文字化けする症状が出ています。

(UnrealEditor-Cmd.exe -run=cookでは上記問題は発生しません。

-utf8outputを追加すれば解決するのですが、その場合Build側のログの2バイト文字が文字化けするため

RunUAT.bat -cook -build 指定時にログの2バイト文字が正常に出力される設定を探しています。

なにか情報は有りますでしょうか。

■再現手順

1. EpicGameLauncherでUE5.8.2を落とす

2. プロジェクトを作成(テスト時はTPS(C++)

3. RunUAT.batでCookを実行

RunUAT.bat BuildCookRun -project=“%UPROJECT%” -platform=Win64 -cook -cookall

※テスト時はエラーを発生させるために、下記のディレクトリをリネームして-cookallを使用

TPPCPP_582EB\Content\Characters

■情報(画像を添付

1.RunUAT.batのCook実行時、ログの2バイト文字が文字化けします。(添付uat_default.PNG

RunUAT.bat BuildCookRun -project=“%UPROJECT%” -platform=Win64 -cook

2.RunUAT.batのCook実行時、-utf8outputを追加するとログの2バイト文字が正常に出力されます。(添付uat_utf8output.PNG

RunUAT.bat BuildCookRun -project=“%UPROJECT%” -platform=Win64 -cook -utf8output

3.RunUAT.batのBuild実行時、-utf8outputを追加するとログの2バイト文字が文字化けします。(添付build_utf8output.PNG

RunUAT.bat BuildCookRun -project=“%UPROJECT%” -platform=Win64 -build -utf8output

4.UnrealEditor-Cmd.exeのCook実行時は、ログの2バイト文字が正常に出力されます。(添付unrealeditorcmd.PNG

UnrealEditor-Cmd.exe “%UPROJECT%” -run=cook -targetplatform=Windows

[Attachment Removed]

再現手順
1. EpicGameLauncherでUE5.8.2を落とす

2. プロジェクトを作成(テスト時はTPS(C++)

3. RunUAT.batでCookを実行

RunUAT.bat" BuildCookRun -project=“%UPROJECT%” -platform=Win64 -cook -cookall

※テスト時はエラーを発生させるために、下記のディレクトリをリネームして-cookallを使用

TPPCPP_582EB\Content\Characters

[Attachment Removed]

お待たせしてしまい大変恐縮です。本件の修正CLが​58447805としてシェルフされており、少なくともcookの文字化けが改善することを確認しています。

ビルドの文字化けについては再現できておらず、恐らくVSの日本語環境のセットアップが必要だと推測していますがお時間を頂くことになってしまうので先んじて回答させていただきます。

もしかするとP4でアクセスできない​可能性があるので修正点を直接以下に記載します。

Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs 330行目付近

			string Args = String.Format(
				"{0} -run={1} {2} -abslog={3} -stdout -CrashForUAT -unattended -NoLogTimes {5}{4}",
				(ProjectFile == null) ? "" : CommandUtils.MakePathSafeToUseWithCommandLine(ProjectFile.FullName),
				Commandlet,
				String.IsNullOrEmpty(Parameters) ? "" : Parameters,
				CommandUtils.MakePathSafeToUseWithCommandLine(LocalLogFile),
				IsBuildMachine ? "-buildmachine" : "",
				(GlobalCommandLine.Verbose || GlobalCommandLine.AllowStdOutLogVerbosity) ? "-AllowStdOutLogVerbosity " : ""
			);
#if 1 // work around
			//Force a UTF 8 environement as the editor only outputs UTF8 now. 
			RunOptions |= ERunOptions.UTF8Output;
#else
			if (GlobalCommandLine.UTF8Output)
			{
				RunOptions |= ERunOptions.UTF8Output;
			}
#endif
			RunResult = Run(EditorExe, Args, Options: RunOptions, Identifier: Commandlet, SpewFilterCallback: SpewFilterCallback);

​

​​

[Attachment Removed]

ご確認ありがとうございます。

UATを介したビルドについては上記の修正では改善しないようです。原因はUATからUBTを起動すると、新しいコンソールでUBTが起動しデフォルトのOEMCodepage(ShiftJis)で出力します。

UATはそれをutf8で受け取ってしまうためです。

修正方針が二つあり、UATの読み込み側をOEMCodePageに対応させるか、UBTを共通のコンソールで起動させるかになります。

試したところ後者の方が修正が小さかったのでこちらをお試しいただけますでしょうか。

修正内容としてはUBTの起動フラグにNoHideWindowを追加する方法です。

		public static void RunUBT(CommandEnvironment Env, FileReference UnrealBuildToolDll, string CommandLine)
		{
			if (!FileReference.Exists(UnrealBuildToolDll))
			{
				throw new AutomationException($"Unable to find UnrealBuildTool.dll: {UnrealBuildToolDll}");
			}
 
			FileReference LogLocation = GetUBTLogLocationFromArgs(Env, CommandLine);
			CommandLine += String.Format(" -log=\"{0}\"", LogLocation);
 
			CommandLine = $"\"{UnrealBuildToolDll}\" {CommandLine}";
//			IProcessResult Result = Run(Unreal.DotnetPath.FullName, CommandLine, Options: ERunOptions.AllowSpew | ERunOptions.NoStdOutCapture);
			IProcessResult Result = Run(Unreal.DotnetPath.FullName, CommandLine, Options: ERunOptions.AllowSpew | ERunOptions.NoStdOutCapture | ERunOptions.NoHideWindow );
			if (Result.ExitCode != 0)
			{
				throw new AutomationException((ExitCode)Result.ExitCode, "UnrealBuildTool failed. See log for more details. ({0})", CommandUtils.CombinePaths(Env.FinalLogFolder, LogLocation.GetFileName())) { OutputFormat = AutomationExceptionOutputFormat.Minimal };
			}
		}

UATをシェルから起動する方法とエディタのメニューからのパッケージ、ProjectLauncherからのパッケージでそれぞれログが正しく出力されることを確認しています。こちらで改善するかご確認いただいてもよろしいでしょうか。

[Attachment Removed]

ご確認ありがとうございます。 本件を UE-400385 UBT compiler output is garbled when run via UAT (Japanese system locale) としてバグ登録させていただきました。

数営業日後にIssuesに公開予定です。それでは正式な修正をお待ちください。

[Attachment Removed]

返答ありがとうございます、確認させていただきます。

[Attachment Removed]

此方でもCook時の文字化けが改善している事を確認しました。

対応ありがとうございます。

Buildにつきましては急いでいませんので、お手すきでよろしくお願いします。

[Attachment Removed]

返答ありがとうございます。

此方でも-utf8output付与したBuild時の文字化けが改善している事を確認しました。

対応ありがとうございます。

今回で、此方での不具合はすべて解決しました。

ひとまず、ワークアラウンドで問題を回避しつつ

アップデートでの正式対応を待ちたいと思います。

質問はクローズとさせていただきます。

対応ありがとうございました。

[Attachment Removed]