Skip to content

Commit

Permalink
Encode the resulting file in UTF-8 without BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNain38 committed Oct 19, 2015
1 parent 5f5f128 commit 4fd0758
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tools/coffee/coffee.wsf
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 4fd0758

Please sign in to comment.