mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
E-book viewer: Fix failure to view comic files that contain non-ASCII characters int heir internal filenames. Fixes #1530517 [Bug with Viewer and Localized characters](https://bugs.launchpad.net/calibre/+bug/1530517)
This commit is contained in:
parent
bd4e970b3a
commit
6e4a31ac87
@ -232,9 +232,10 @@ class ComicInput(InputFormatPlugin):
|
||||
def create_wrappers(self, pages):
|
||||
from calibre.ebooks.oeb.base import XHTML_NS
|
||||
wrappers = []
|
||||
WRAPPER = textwrap.dedent('''\
|
||||
WRAPPER = textwrap.dedent(u'''\
|
||||
<html xmlns="%s">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Page #%d</title>
|
||||
<style type="text/css">
|
||||
@page { margin:0pt; padding: 0pt}
|
||||
@ -253,7 +254,8 @@ class ComicInput(InputFormatPlugin):
|
||||
for i, page in enumerate(pages):
|
||||
wrapper = WRAPPER%(XHTML_NS, i+1, os.path.basename(page), i+1)
|
||||
page = os.path.join(dir, u'page_%d.xhtml'%(i+1))
|
||||
open(page, 'wb').write(wrapper)
|
||||
with open(page, 'wb') as f:
|
||||
f.write(wrapper.encode('utf-8'))
|
||||
wrappers.append(page)
|
||||
return wrappers
|
||||
|
||||
|
@ -1493,7 +1493,10 @@ class OPFCreator(Metadata):
|
||||
manifest = E.manifest()
|
||||
if self.manifest is not None:
|
||||
for ref in self.manifest:
|
||||
item = E.item(id=str(ref.id), href=ref.href())
|
||||
href = ref.href()
|
||||
if isinstance(href, bytes):
|
||||
href = href.decode('utf-8')
|
||||
item = E.item(id=str(ref.id), href=href)
|
||||
item.set('media-type', ref.mime_type)
|
||||
manifest.append(item)
|
||||
spine = E.spine()
|
||||
|
Loading…
x
Reference in New Issue
Block a user