mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1606 (Accented o (with tilde) makes lrfviewer croak)
This commit is contained in:
parent
4741e10a7a
commit
87657c6fd4
@ -698,9 +698,12 @@ class Text(LRFStream):
|
|||||||
lineposition_map = {1:'before', 2:'after'}
|
lineposition_map = {1:'before', 2:'after'}
|
||||||
|
|
||||||
def add_text(self, text):
|
def add_text(self, text):
|
||||||
s = unicode(text, "utf-16-le")
|
try:
|
||||||
|
s = unicode(text, "utf-16-le")
|
||||||
|
except UnicodeDecodeError: # Work around for Book Designer
|
||||||
|
s = unicode(text+'\x00', 'utf-16-le')
|
||||||
if s:
|
if s:
|
||||||
s = s.translate(self.text_map)
|
s = s.translate(self.text_map)
|
||||||
self.content.append(self.entity_pattern.sub(entity_to_unicode, s))
|
self.content.append(self.entity_pattern.sub(entity_to_unicode, s))
|
||||||
|
|
||||||
def end_container(self, tag, stream):
|
def end_container(self, tag, stream):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user