Encode the resulting file in UTF-8 without BOM

This commit is contained in:
TheNain38 2015-10-19 14:06:59 +02:00
parent 5f5f128b8a
commit 4fd0758acb
1 changed files with 13 additions and 3 deletions

View File

@ -82,12 +82,22 @@ function readUtf8(filename) {
function writeUtf8(filename, text) {
var stream = new ActiveXObject("ADODB.Stream");
stream.Open();
stream.Type = 2; // Text
stream.Charset = 'utf-8';
stream.Charset = "utf-8";
stream.Open();
stream.WriteText(text);
stream.Position = 0;
stream.Type = 1; // Binary
stream.Position = 3;
var binary = stream.Read();
stream.Close();
stream.Open();
stream.Type = 1; // Binary
stream.Write(binary);
stream.SaveToFile(filename, 2);
stream.Close();
}
</script>
</job>
</job>