mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #1410 (Error using preview on downloaded news)
This commit is contained in:
parent
e4833b7835
commit
71dea7b4ee
@ -43,7 +43,11 @@ def update_module(mod, path):
|
|||||||
zp = os.path.join(os.path.dirname(sys.executable), 'library.zip')
|
zp = os.path.join(os.path.dirname(sys.executable), 'library.zip')
|
||||||
elif isosx:
|
elif isosx:
|
||||||
zp = os.path.join(os.path.dirname(getattr(sys, 'frameworks_dir')),
|
zp = os.path.join(os.path.dirname(getattr(sys, 'frameworks_dir')),
|
||||||
'Resources', 'lib', 'python2.5', 'site-packages.zip')
|
'Resources', 'lib',
|
||||||
|
'python'+'.'.join(map(str, sys.version_info[:2])),
|
||||||
|
'site-packages.zip')
|
||||||
|
else:
|
||||||
|
zp = os.path.join(getattr(sys, 'frozen_path'), 'loader.zip')
|
||||||
if zp is not None:
|
if zp is not None:
|
||||||
update_zipfile(zp, mod, path)
|
update_zipfile(zp, mod, path)
|
||||||
else:
|
else:
|
||||||
|
@ -1166,7 +1166,9 @@ class TOCObject(LRFStream):
|
|||||||
refpage = struct.unpack("<I", stream.read(4))[0]
|
refpage = struct.unpack("<I", stream.read(4))[0]
|
||||||
refobj = struct.unpack("<I", stream.read(4))[0]
|
refobj = struct.unpack("<I", stream.read(4))[0]
|
||||||
cnt = struct.unpack("<H", stream.read(2))[0]
|
cnt = struct.unpack("<H", stream.read(2))[0]
|
||||||
label = unicode(stream.read(cnt), "utf_16")
|
raw = stream.read(cnt)
|
||||||
|
print repr(raw)
|
||||||
|
label = raw.decode('utf_16_le')
|
||||||
self._contents.append(TocLabel(refpage, refobj, label))
|
self._contents.append(TocLabel(refpage, refobj, label))
|
||||||
c -= 1
|
c -= 1
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ class ZipInfo (object):
|
|||||||
if isinstance(self.filename, unicode):
|
if isinstance(self.filename, unicode):
|
||||||
try:
|
try:
|
||||||
return self.filename.encode('ascii'), self.flag_bits
|
return self.filename.encode('ascii'), self.flag_bits
|
||||||
except UnicodeEncodeError:
|
except:
|
||||||
return self.filename.encode('utf-8'), self.flag_bits | 0x800
|
return self.filename.encode('utf-8'), self.flag_bits | 0x800
|
||||||
else:
|
else:
|
||||||
return self.filename, self.flag_bits
|
return self.filename, self.flag_bits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user