mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-23 16:34:52 +01:00
Fix unicode handling in old style UserProfiles
This commit is contained in:
parent
80c2a125e7
commit
efbc08ddf0
1 changed files with 6 additions and 3 deletions
|
|
@ -9,7 +9,7 @@
|
|||
from htmlentitydefs import name2codepoint
|
||||
from email.utils import formatdate
|
||||
|
||||
from calibre import __appname__, iswindows, browser
|
||||
from calibre import __appname__, iswindows, browser, strftime
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup, NavigableString, CData, Tag
|
||||
|
||||
|
||||
|
|
@ -211,6 +211,9 @@ def build_sub_index(title, items):
|
|||
src = build_sub_index(category, articles[category])
|
||||
open(cfile, 'wb').write(src.encode(encoding))
|
||||
|
||||
title = self.title
|
||||
if not isinstance(title, unicode):
|
||||
title = unicode(title, 'utf-8', 'replace')
|
||||
src = u'''\
|
||||
<html>
|
||||
<body>
|
||||
|
|
@ -221,8 +224,8 @@ def build_sub_index(title, items):
|
|||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
'''%dict(date=time.strftime('%a, %d %B, %Y', time.localtime()),
|
||||
categories=clist, title=self.title)
|
||||
'''%dict(date=strftime('%a, %d %B, %Y'),
|
||||
categories=clist, title=title)
|
||||
index = os.path.join(self.temp_dir, 'index.html')
|
||||
open(index, 'wb').write(src.encode(encoding))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue