mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Catalog generation: Fix error creating epub/mobi catalogs on non UTF-8 windows systems when the metadata contained non ASCII characters
This commit is contained in:
parent
9cd8f008e2
commit
36b52e8b2d
@ -10,7 +10,7 @@ from xml.sax.saxutils import escape
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
from types import StringType, UnicodeType
|
from types import StringType, UnicodeType
|
||||||
|
|
||||||
from calibre import prints, prepare_string_for_xml, strftime
|
from calibre import (prints, prepare_string_for_xml, strftime, force_unicode)
|
||||||
from calibre.constants import preferred_encoding, DEBUG
|
from calibre.constants import preferred_encoding, DEBUG
|
||||||
from calibre.customize import CatalogPlugin
|
from calibre.customize import CatalogPlugin
|
||||||
from calibre.customize.conversion import OptionRecommendation, DummyReporter
|
from calibre.customize.conversion import OptionRecommendation, DummyReporter
|
||||||
@ -1083,15 +1083,11 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.__totalSteps += incremental_jobs
|
self.__totalSteps += incremental_jobs
|
||||||
|
|
||||||
# Load section list templates
|
# Load section list templates
|
||||||
templates = []
|
templates = {}
|
||||||
with open(P('catalog/section_list_templates.py'), 'r') as f:
|
execfile(P('catalog/section_list_templates.py'), templates)
|
||||||
for line in f:
|
for name, template in templates.iteritems():
|
||||||
t = re.match("(by_.+_template)",line)
|
if name.startswith('by_') and name.endswith('_template'):
|
||||||
if t:
|
setattr(self, name, force_unicode(template, 'utf-8'))
|
||||||
templates.append(t.group(1))
|
|
||||||
execfile(P('catalog/section_list_templates.py'), locals())
|
|
||||||
for t in templates:
|
|
||||||
setattr(self,t,eval(t))
|
|
||||||
|
|
||||||
# Accessors
|
# Accessors
|
||||||
if True:
|
if True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user