From 7764b0b0074f24faec1711e090787471a5a0cd8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Jan 2011 10:16:51 -0700 Subject: [PATCH] LIT Input: Handle LIT files that have all their text in a single
 tag and use entities

---
 src/calibre/ebooks/lit/input.py             | 5 ++++-
 src/calibre/gui2/dialogs/restore_library.py | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/calibre/ebooks/lit/input.py b/src/calibre/ebooks/lit/input.py
index ff901c3715..9ccbba543f 100644
--- a/src/calibre/ebooks/lit/input.py
+++ b/src/calibre/ebooks/lit/input.py
@@ -38,13 +38,16 @@ class LITInput(InputFormatPlugin):
                 if len(body) == 1 and body[0].tag == XHTML('pre'):
                     pre = body[0]
                     from calibre.ebooks.txt.processor import convert_basic, preserve_spaces, \
-                    separate_paragraphs_single_line
+                        separate_paragraphs_single_line
+                    from calibre.ebooks.chardet import xml_to_unicode
                     from lxml import etree
                     import copy
                     html = separate_paragraphs_single_line(pre.text)
                     html = preserve_spaces(html)
                     html = convert_basic(html).replace('',
                             ''%XHTML_NS)
+                    html = xml_to_unicode(html, strip_encoding_pats=True,
+                            resolve_entities=True)[0]
                     root = etree.fromstring(html)
                     body = XPath('//h:body')(root)
                     pre.tag = XHTML('div')
diff --git a/src/calibre/gui2/dialogs/restore_library.py b/src/calibre/gui2/dialogs/restore_library.py
index b5af0fcadd..a57d6c86c1 100644
--- a/src/calibre/gui2/dialogs/restore_library.py
+++ b/src/calibre/gui2/dialogs/restore_library.py
@@ -21,7 +21,7 @@ class DBRestore(QDialog):
         self.l = QVBoxLayout()
         self.setLayout(self.l)
         self.l1 = QLabel(''+_('Restoring database from backups, do not'
-            ' interrupt, this will happen in two stages')+'...')
+            ' interrupt, this will happen in three stages')+'...')
         self.setWindowTitle(_('Restoring database'))
         self.l.addWidget(self.l1)
         self.pb = QProgressBar(self)