浏览代码

Compiling through a Batch file should not produce a BOM.

David Piuva 1 年之前
父节点
当前提交
c4b0d3fee9
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Source/tools/builder/code/generator.cpp

+ 2 - 1
Source/tools/builder/code/generator.cpp

@@ -217,7 +217,8 @@ void produce(SessionContext &input, const ReadableString &scriptPath, ScriptLang
 	if (GENERATE) {
 		printText(U"Saving script to ", scriptPath, "\n");
 		if (language == ScriptLanguage::Batch) {
-			string_save(scriptPath, generatedCode);
+			// Batch on MS-Windows can not recognize a Byte Order Mark, so just encode it as Latin 1.
+			string_save(scriptPath, generatedCode, CharacterEncoding::Raw_Latin1, LineEncoding::CrLf);
 		} else if (language == ScriptLanguage::Bash) {
 			string_save(scriptPath, generatedCode, CharacterEncoding::BOM_UTF8, LineEncoding::Lf);
 		}