mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Realized that str.replace() won't have the intended effect on UTF-16 (etc) encoded content.
This commit is contained in:
parent
a3bc14fcfa
commit
66042b5512
@ -334,8 +334,6 @@ class Manifest(object):
|
|||||||
# Possibly decode in user-specified encoding
|
# Possibly decode in user-specified encoding
|
||||||
if self.oeb.encoding is not None:
|
if self.oeb.encoding is not None:
|
||||||
data = data.decode(self.oeb.encoding, 'replace')
|
data = data.decode(self.oeb.encoding, 'replace')
|
||||||
# Force to UNIX line encodings
|
|
||||||
data = data.replace('\r\n', '\n').replace('\r', '\n')
|
|
||||||
# Handle broken XHTML w/ SVG (ugh)
|
# Handle broken XHTML w/ SVG (ugh)
|
||||||
if 'svg:' in data and SVG_NS not in data:
|
if 'svg:' in data and SVG_NS not in data:
|
||||||
data = data.replace(
|
data = data.replace(
|
||||||
@ -824,7 +822,6 @@ class OEBBook(object):
|
|||||||
|
|
||||||
def _read_opf(self, opfpath):
|
def _read_opf(self, opfpath):
|
||||||
opf = self.container.read(opfpath)
|
opf = self.container.read(opfpath)
|
||||||
opf = opf.replace('\r\n', '\n').replace('\r', '\n')
|
|
||||||
try:
|
try:
|
||||||
opf = etree.fromstring(opf)
|
opf = etree.fromstring(opf)
|
||||||
except etree.XMLSyntaxError:
|
except etree.XMLSyntaxError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user