mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GR TOC bug fix utf-8 > latin_1
This commit is contained in:
parent
525bfdb913
commit
e60d72753e
@ -1695,12 +1695,11 @@ class MobiWriter(object):
|
|||||||
header.write(pack('>I', 1))
|
header.write(pack('>I', 1))
|
||||||
|
|
||||||
# 0x1c - 0x1f : Text encoding ?
|
# 0x1c - 0x1f : Text encoding ?
|
||||||
# header.write(pack('>I', 650001))
|
# GR: Language encoding for NCX entries (latin_1)
|
||||||
# GR: This needs to be either 0xFDE9 or 0x4E4
|
header.write(pack('>I', 0x4e4))
|
||||||
header.write(pack('>I', 0xFDE9))
|
|
||||||
|
|
||||||
# 0x20 - 0x23 : Language code?
|
# 0x20 - 0x23 : Mimicking kindleGen
|
||||||
header.write(iana2mobi(str(self._oeb.metadata.language[0])))
|
header.write(pack('>I', 0xFFFFFFFF))
|
||||||
|
|
||||||
# 0x24 - 0x27 : Number of TOC entries in INDX1
|
# 0x24 - 0x27 : Number of TOC entries in INDX1
|
||||||
header.write(pack('>I', indxt_count + 1))
|
header.write(pack('>I', indxt_count + 1))
|
||||||
@ -1799,9 +1798,9 @@ class MobiWriter(object):
|
|||||||
text = text.strip()
|
text = text.strip()
|
||||||
if not isinstance(text, unicode):
|
if not isinstance(text, unicode):
|
||||||
text = text.decode('utf-8', 'replace')
|
text = text.decode('utf-8', 'replace')
|
||||||
text = text.encode('utf-8')
|
text = text.encode('cp1252','replace')
|
||||||
else :
|
else :
|
||||||
text = "(none)".encode('utf-8')
|
text = text.encode('cp1252')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def _add_to_ctoc(self, ctoc_str, record_offset):
|
def _add_to_ctoc(self, ctoc_str, record_offset):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user