mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4683 (If comics.txt is UTF-8 with a byte order mark, the first comic is skipped)
This commit is contained in:
parent
37c90afed4
commit
79bb3ba005
@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
Based on ideas from comiclrf created by FangornUK.
|
Based on ideas from comiclrf created by FangornUK.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os, shutil, traceback, textwrap, time
|
import os, shutil, traceback, textwrap, time, codecs
|
||||||
from ctypes import byref
|
from ctypes import byref
|
||||||
from Queue import Empty
|
from Queue import Empty
|
||||||
|
|
||||||
@ -338,8 +338,9 @@ class ComicInput(InputFormatPlugin):
|
|||||||
if not os.path.exists('comics.txt'):
|
if not os.path.exists('comics.txt'):
|
||||||
raise ValueError('%s is not a valid comic collection'
|
raise ValueError('%s is not a valid comic collection'
|
||||||
%stream.name)
|
%stream.name)
|
||||||
for line in open('comics.txt',
|
raw = open('comics.txt', 'rb').read().decode('utf-8')
|
||||||
'rb').read().decode('utf-8').splitlines():
|
raw.lstrip(unicode(codecs.BOM_UTF8, "utf8" ))
|
||||||
|
for line in raw.splitlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user