mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix encoding problems with creation of TOC for recipes
This commit is contained in:
parent
be1dc747b5
commit
efc0a61e70
@ -1,6 +1,7 @@
|
||||
<ncx version="2005-1"
|
||||
xml:lang="en"
|
||||
xmlns="http://www.daisy.org/z3986/2005/ncx/"
|
||||
encoding="UTF-8"
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
>
|
||||
<head>
|
||||
|
@ -7,6 +7,7 @@ from urllib import unquote
|
||||
|
||||
from calibre import __appname__
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, BeautifulSoup
|
||||
from calibre.ebooks.chardet import xml_to_unicode
|
||||
|
||||
class NCXSoup(BeautifulStoneSoup):
|
||||
|
||||
@ -95,7 +96,9 @@ class TOC(list):
|
||||
|
||||
def read_ncx_toc(self, toc):
|
||||
self.base_path = os.path.dirname(toc)
|
||||
soup = NCXSoup(open(toc, 'rb').read())
|
||||
print xml_to_unicode(open(toc, 'rb').read(), True)[1]
|
||||
soup = NCXSoup(xml_to_unicode(open(toc, 'rb').read())[0])
|
||||
print unicode(soup).encode('utf8')
|
||||
|
||||
def process_navpoint(np, dest):
|
||||
play_order = np.get('playOrder', 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user