1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-12 08:03:33 +02:00

Removed another unicode/string nonsense

This commit is contained in:
2020-04-23 19:51:25 +02:00
parent de4f8a444b
commit 16d169d0d6
13 changed files with 20 additions and 86 deletions

View File

@@ -4,11 +4,6 @@ from ebook_converter.ebooks.lrf.fonts import get_font
from ebook_converter.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \
CharButton, Plot, Paragraph, \
LrsTextTag
from ebook_converter.polyglot.builtins import native_string_type
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
def ceil(num):
@@ -17,8 +12,8 @@ def ceil(num):
def print_xml(elem):
from ebook_converter.ebooks.lrf.pylrs.pylrs import ElementWriter
elem = elem.toElement(native_string_type('utf8'))
ew = ElementWriter(elem, sourceEncoding=native_string_type('utf8'))
elem = elem.toElement('utf8')
ew = ElementWriter(elem, sourceEncoding='utf8')
ew.write(sys.stdout)
print()

View File

@@ -51,7 +51,6 @@ DEFAULT_GENREADING = "fs" # default is yes to both lrf and lrs
from ebook_converter import __appname__, __version__
from ebook_converter import entity_to_unicode
from ebook_converter.polyglot.builtins import native_string_type
class LrsError(Exception):
@@ -617,7 +616,7 @@ class Book(Delegator):
_formatXml(root)
tree = ElementTree(element=root)
tree.write(f, encoding=native_string_type(outputEncodingName), xml_declaration=True)
tree.write(f, encoding=outputEncodingName, xml_declaration=True)
class BookInformation(Delegator):
@@ -669,7 +668,7 @@ class Info(Delegator):
# NB: generates an encoding attribute, which lrs2lrf does not
tree = ElementTree(element=info)
f = io.BytesIO()
tree.write(f, encoding=native_string_type('utf-8'), xml_declaration=True)
tree.write(f, encoding='utf-8', xml_declaration=True)
xmlInfo = f.getvalue().decode('utf-8')
xmlInfo = re.sub(r"<CThumbnail.*?>\n", "", xmlInfo)
xmlInfo = xmlInfo.replace("SumPage>", "Page>")