mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-31 12:06:22 +01: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
1 changed files with 4 additions and 3 deletions
|
|
@ -7,7 +7,7 @@
|
|||
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 Queue import Empty
|
||||
|
||||
|
|
@ -338,8 +338,9 @@ def get_comics_from_collection(self, stream):
|
|||
if not os.path.exists('comics.txt'):
|
||||
raise ValueError('%s is not a valid comic collection'
|
||||
%stream.name)
|
||||
for line in open('comics.txt',
|
||||
'rb').read().decode('utf-8').splitlines():
|
||||
raw = open('comics.txt', 'rb').read().decode('utf-8')
|
||||
raw.lstrip(unicode(codecs.BOM_UTF8, "utf8" ))
|
||||
for line in raw.splitlines():
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue