Encode the resulting file in UTF-8 without BOM
This commit is contained in:
parent
5f5f128b8a
commit
4fd0758acb
1 changed files with 13 additions and 3 deletions
|
@ -82,12 +82,22 @@ function readUtf8(filename) {
|
||||||
|
|
||||||
function writeUtf8(filename, text) {
|
function writeUtf8(filename, text) {
|
||||||
var stream = new ActiveXObject("ADODB.Stream");
|
var stream = new ActiveXObject("ADODB.Stream");
|
||||||
stream.Open();
|
|
||||||
stream.Type = 2; // Text
|
stream.Type = 2; // Text
|
||||||
stream.Charset = 'utf-8';
|
stream.Charset = "utf-8";
|
||||||
|
stream.Open();
|
||||||
stream.WriteText(text);
|
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.SaveToFile(filename, 2);
|
||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</job>
|
</job>
|
||||||
|
|
Loading…
Reference in a new issue