mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02: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
1 changed files with 6 additions and 10 deletions
|
|
@ -10,7 +10,7 @@
|
|||
from lxml import etree
|
||||
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.customize import CatalogPlugin
|
||||
from calibre.customize.conversion import OptionRecommendation, DummyReporter
|
||||
|
|
@ -1083,15 +1083,11 @@ def __init__(self, db, opts, plugin,
|
|||
self.__totalSteps += incremental_jobs
|
||||
|
||||
# Load section list templates
|
||||
templates = []
|
||||
with open(P('catalog/section_list_templates.py'), 'r') as f:
|
||||
for line in f:
|
||||
t = re.match("(by_.+_template)",line)
|
||||
if t:
|
||||
templates.append(t.group(1))
|
||||
execfile(P('catalog/section_list_templates.py'), locals())
|
||||
for t in templates:
|
||||
setattr(self,t,eval(t))
|
||||
templates = {}
|
||||
execfile(P('catalog/section_list_templates.py'), templates)
|
||||
for name, template in templates.iteritems():
|
||||
if name.startswith('by_') and name.endswith('_template'):
|
||||
setattr(self, name, force_unicode(template, 'utf-8'))
|
||||
|
||||
# Accessors
|
||||
if True:
|
||||
|
|
|
|||
Loading…
Reference in a new issue