Browse Source

added BOM to hlc files (close #5995)

Nicolas Cannasse 7 years ago
parent
commit
79642b009f
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/generators/hl2c.ml

+ 3 - 1
src/generators/hl2c.ml

@@ -245,12 +245,14 @@ let close_file ctx =
 		close_out ch;
 		close_out ch;
 	end
 	end
 
 
+let bom = "\xEF\xBB\xBF"
+
 let open_file ctx file =
 let open_file ctx file =
 	if ctx.curfile <> "" then close_file ctx;
 	if ctx.curfile <> "" then close_file ctx;
 	let version_major = ctx.version / 1000 in
 	let version_major = ctx.version / 1000 in
 	let version_minor = (ctx.version mod 1000) / 100 in
 	let version_minor = (ctx.version mod 1000) / 100 in
 	let version_revision = (ctx.version mod 100) in
 	let version_revision = (ctx.version mod 100) in
-	if file <> "hlc.json" then line ctx (sprintf "// Generated by HLC %d.%d.%d (HL v%d)" version_major version_minor version_revision ctx.hlcode.version);
+	if file <> "hlc.json" then line ctx (sprintf "%s// Generated by HLC %d.%d.%d (HL v%d)" bom version_major version_minor version_revision ctx.hlcode.version);
 	ctx.curfile <- file
 	ctx.curfile <- file
 
 
 let string_data_limit = 64
 let string_data_limit = 64