Skip to content

Commit

Permalink
OB-91: make sure href is unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
bjandras authored and Borko Jandras committed May 27, 2013
1 parent d810467 commit 7907ec7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/objavi/epub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,16 @@ def write_blob(self, path, blob, compression=ZIP_DEFLATED, mode=0644):
self.zipfile.writestr(zinfo, blob)

def add_file(self, ID, filename, mediatype, content, properties=None):
filename = filename.encode('utf-8')
self.write_blob(filename, content)
self.manifest[ID] = {'media-type': mediatype.encode('utf-8'),
'id': ID.encode('utf-8'),
'href': filename,
}

self.manifest[ID] = {
'id': ID,
'href': unicode(filename, 'utf-8'),
'media-type': mediatype,
}

if properties:
self.manifest[ID]['properties'] = properties.encode('utf-8')
self.manifest[ID]['properties']

def add_ncx(self, toc, filemap, ID, title):
ncx = make_ncx(toc, filemap, ID, title)
Expand Down

0 comments on commit 7907ec7

Please sign in to comment.