View Single Post
Old 08-30-2014, 04:21 PM   #955
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,651
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi Doitsu,

Please try the following change in mobi_dict.py

Change the following:
Code:
                    if hordt2 is not None:
                        utext = u""
                        n = len(text)/2
                        offsets = struct.unpack('>%dH' % n, text)
                        for off in offsets:
                            if off < len(hordt2):
                                utext += unichr(hordt2[off])
                            else:
                                utext += unichr(off)
                        text = utext.encode('utf-8')
to

Code:
                    if hordt2 is not None and len(text) > 0:
                        utext = u""
                        n = len(text)/2
                        offsets = struct.unpack('>%dH' % n, text)
                        for off in offsets:
                            if off < len(hordt2):
                                utext += unichr(hordt2[off])
                            else:
                                utext += unichr(off)
                        text = utext.encode('utf-8')

Just the first line is changed. I think text is a null string which is freaking out struct.unpack() so we are screening this case out.

Please let me know if this helps.

KevinH
KevinH is offline   Reply With Quote