From: Radek Czajka Date: Thu, 2 Dec 2010 13:43:03 +0000 (+0100) Subject: strip BOM X-Git-Tag: 1.7~242 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/f33381c4b0468544123ff05295033da7cc4bf61f?hp=1507c9cae9fe18dc9ea5f579354bd7af8ab96141 strip BOM --- diff --git a/librarian/epub.py b/librarian/epub.py index e25ce8f..3bdd1cd 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -82,7 +82,8 @@ def replace_characters(node): def replace_chars(text): if text is None: return None - return text.replace("---", u"\u2014")\ + return text.replace(u"\ufeff", u"")\ + .replace("---", u"\u2014")\ .replace("--", u"\u2013")\ .replace(",,", u"\u201E")\ .replace('"', u"\u201D")\ diff --git a/librarian/parser.py b/librarian/parser.py index 3f9f710..341eaf8 100644 --- a/librarian/parser.py +++ b/librarian/parser.py @@ -57,6 +57,8 @@ class WLDocument(object): if not isinstance(data, unicode): data = data.decode('utf-8') + data = data.replace(u'\ufeff', '') + if swap_endlines: sub = u'
' if preserve_lines: