From fba40123e109ea63561c7d463657874cc0b4c146 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Thu, 17 Jan 2019 12:55:49 +0100 Subject: [PATCH] Only include BOM if it isn't already present. --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 465ce9e..d9fdd3c 100755 --- a/main.py +++ b/main.py @@ -707,7 +707,8 @@ def main(argv): del script_header, script_timestamp if bom: - script = b'\xEF\xBB\xBF' + script + if not script.startswith(b'\xEF\xBB\xBF'): + script = b'\xEF\xBB\xBF' + script if outfile == '-': sys.stdout.write(script)