mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove BOM bytes from recipes as well when compiling
This commit is contained in:
parent
959acc1f28
commit
65ca3c490a
@ -34,7 +34,7 @@ def compile_recipe(src):
|
|||||||
enc = match.group(1) if match else 'utf-8'
|
enc = match.group(1) if match else 'utf-8'
|
||||||
src = src.decode(enc)
|
src = src.decode(enc)
|
||||||
# Python complains if there is a coding declaration in a unicode string
|
# Python complains if there is a coding declaration in a unicode string
|
||||||
src = re.sub(r'^#.*coding\s*[:=]\s*([-\w.]+)', '#', src, flags=re.MULTILINE)
|
src = re.sub(r'^#.*coding\s*[:=]\s*([-\w.]+)', '#', src.lstrip(u'\ufeff'), flags=re.MULTILINE)
|
||||||
# Translate newlines to \n
|
# Translate newlines to \n
|
||||||
src = io.StringIO(src, newline=None).getvalue()
|
src = io.StringIO(src, newline=None).getvalue()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user