From 338d642ec5923d580260dd4f793c47a98aa16af1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Nov 2009 20:01:36 -0700 Subject: [PATCH] IGN:... --- src/calibre/ebooks/oeb/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index f507232ae5..b86819a441 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1750,10 +1750,13 @@ class OEBBook(object): if data[:4] in ('\0\0\xfe\xff', '\xff\xfe\0\0'): bom_enc = {'\0\0\xfe\xff':'utf-32-be', '\xff\xfe\0\0':'utf-32-le'}[data[:4]] + data = data[4:] elif data[:2] in ('\xff\xfe', '\xfe\xff'): bom_enc = {'\xff\xfe':'utf-16-le', '\xfe\xff':'utf-16-be'}[data[:2]] + data = data[2:] elif data[:3] == '\xef\xbb\xbf': bom_enc = 'utf-8' + data = data[3:] if bom_enc is not None: try: return fix_data(data.decode(bom_enc))