diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index eeef720144..041a9922cb 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -212,7 +212,11 @@ class Serializer(object): if tocref.klass == "periodical": buf.write('
') else: - buf.write('

'+tocref.title+'

') + t = tocref.title + if isinstance(t, unicode): + t = t.encode('utf-8') + buf.write('

' + +t+'

') buf.write('
    ') @@ -221,14 +225,17 @@ class Serializer(object): itemhref = tocitem.href if tocref.klass == 'periodical': # This is a section node. - # For periodical toca, the section urls are like r'feed_\d+/index.html' + # For periodical tocs, the section urls are like r'feed_\d+/index.html' # We dont want to point to the start of the first article # so we change the href. itemhref = re.sub(r'article_\d+/', '', itemhref) self.href_offsets[itemhref].append(buf.tell()) buf.write('0000000000') buf.write(' >') - buf.write(tocitem.title) + t = tocitem.title + if isinstance(t, unicode): + t = t.encode('utf-8') + buf.write(t) buf.write('') buf.write('
')