mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2623 (UnicodeEncodeError: 'ascii' codec can't encode character u'\xe6' in position 458: ordinal not in range(128))
This commit is contained in:
parent
12f0d53b1a
commit
bd59e2453c
@ -56,6 +56,7 @@ class EPUBOutput(OutputFormatPlugin):
|
|||||||
TITLEPAGE_COVER = '''\
|
TITLEPAGE_COVER = '''\
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<title>Cover</title>
|
<title>Cover</title>
|
||||||
<style type="text/css" title="override_css">
|
<style type="text/css" title="override_css">
|
||||||
@page {padding: 0pt; margin:0pt}
|
@page {padding: 0pt; margin:0pt}
|
||||||
|
@ -20,7 +20,7 @@ from calibre.utils.config import DynamicConfig
|
|||||||
from calibre.utils.logging import Log
|
from calibre.utils.logging import Log
|
||||||
from calibre.ebooks.epub.output import EPUBOutput
|
from calibre.ebooks.epub.output import EPUBOutput
|
||||||
|
|
||||||
TITLEPAGE = EPUBOutput.TITLEPAGE_COVER
|
TITLEPAGE = EPUBOutput.TITLEPAGE_COVER.decode('utf-8')
|
||||||
|
|
||||||
def character_count(html):
|
def character_count(html):
|
||||||
'''
|
'''
|
||||||
@ -149,7 +149,8 @@ class EbookIterator(object):
|
|||||||
if self.ebook_ext in ('lit', 'mobi', 'prc', 'opf') and cover:
|
if self.ebook_ext in ('lit', 'mobi', 'prc', 'opf') and cover:
|
||||||
cfile = os.path.join(os.path.dirname(self.spine[0]),
|
cfile = os.path.join(os.path.dirname(self.spine[0]),
|
||||||
'calibre_iterator_cover.html')
|
'calibre_iterator_cover.html')
|
||||||
open(cfile, 'wb').write(TITLEPAGE%cover)
|
chtml = (TITLEPAGE%cover).encode('utf-8')
|
||||||
|
open(cfile, 'wb').write(chtml)
|
||||||
self.spine[0:0] = [SpineItem(cfile)]
|
self.spine[0:0] = [SpineItem(cfile)]
|
||||||
self.delete_on_exit.append(cfile)
|
self.delete_on_exit.append(cfile)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user