Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
fix(*): WIP
Browse files Browse the repository at this point in the history
  Fix utf-8 decode for ebook generate
  Fix viewer compile
  • Loading branch information
kurikomoe committed Feb 8, 2023
1 parent 1167786 commit 3615238
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/calibre/ebooks/mobi/writer2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def write_header(self): # PalmDB header {{{
title = ascii_filename(str(self.oeb.metadata.title[0])).replace(
' ', '_')
if not isinstance(title, bytes):
title = title.encode('ascii')
title = title.encode('utf-8')
title = title[:31]
title = title + (b'\0' * (32 - len(title)))
now = int(time.time())
Expand Down
2 changes: 1 addition & 1 deletion src/calibre/ebooks/mobi/writer8/mobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def write(self, outpath):

title = ascii_filename(self.full_title.decode('utf-8')).replace(' ', '_')
if not isinstance(title, bytes):
title = title.encode('ascii')
title = title.encode('utf-8')
title = title[:31]
title += (b'\0' * (32 - len(title)))
now = int(time.time())
Expand Down
8 changes: 4 additions & 4 deletions src/calibre/gui2/viewer/web_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ def create_profile():
# Qt bugs see workaround_qt_bug() in ajax.pyj
ua = f'calibre-viewer {__version__} {osname}'
ans.setHttpUserAgent(ua)
if is_running_from_develop:
from calibre.utils.rapydscript import compile_viewer
prints('Compiling viewer code...')
compile_viewer()
# if is_running_from_develop:
# from calibre.utils.rapydscript import compile_viewer
# prints('Compiling viewer code...')
# compile_viewer()
js = P('viewer.js', data=True, allow_user_override=False)
translations_json = get_translations_data() or b'null'
js = js.replace(b'__TRANSLATIONS_DATA__', translations_json, 1)
Expand Down

0 comments on commit 3615238

Please sign in to comment.