mcscript icon indicating copy to clipboard operation
mcscript copied to clipboard

Byte order mark causes compilation error

Open Nixinova opened this issue 4 years ago • 2 comments

Any scripts that have a byte order mark accidentally added will not compile, with the following error message being produced:

 [Error] Can't handle character: "" (0:0) in file .//data/mb/scripts/map/countdown.mcscript

 .//data/mb/scripts/map/countdown.mcscript was not compiled!

BOM can be removed using something like the following:

.replace(/^\uFEFF|^\u00BB\u00BF/,"");

I can issue a PR doing so later.

Nixinova avatar Apr 11 '21 04:04 Nixinova

@Nixinova I like your idea of replacing the added BOM as per https://github.com/Stevertus/mcscript/pull/39 as a 'work-around' to keep things running, so to speak. But I wonder what causes the Any scripts that have a byte order mark accidentally added part in the first place? Maybe someone should look into fixing whatever is the 'cause' that is adding it?

drhuffman12 avatar May 27 '21 17:05 drhuffman12

whatever is the 'cause' that is adding it?

It's just a different file encoding type in my editor. Vscode has encoding types e.g. utf8, utf16, utf8+bom etc.

Nixinova avatar May 27 '21 19:05 Nixinova