mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Ensure all builting recipes are in utf-8 and have the functions to get recipe code return unicode
This commit is contained in:
parent
7c07d114ac
commit
8eac004f89
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: latin-1 mode: python -*-
|
||||
# -*- coding: utf-8 mode: python -*-
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009-2015, Darko Miletic <darko.miletic at gmail.com>'
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: cp1252 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
|
@ -221,6 +221,7 @@ def download_builtin_recipe(urn):
|
||||
import bz2
|
||||
recipe_source = bz2.decompress(get_https_resource_securely(
|
||||
'https://code.calibre-ebook.com/recipe-compressed/'+urn, headers={'CALIBRE-INSTALL-UUID':prefs['installation_uuid']}))
|
||||
recipe_source = recipe_source.decode('utf-8')
|
||||
from calibre.web.feeds.recipes import compile_recipe
|
||||
recipe = compile_recipe(recipe_source) # ensure the downloaded recipe is at least compile-able
|
||||
if recipe is None:
|
||||
@ -232,7 +233,7 @@ def download_builtin_recipe(urn):
|
||||
|
||||
def get_builtin_recipe(urn):
|
||||
with zipfile.ZipFile(P('builtin_recipes.zip', allow_user_override=False), 'r') as zf:
|
||||
return zf.read(urn+'.recipe')
|
||||
return zf.read(urn+'.recipe').decode('utf-8')
|
||||
|
||||
|
||||
def get_builtin_recipe_by_title(title, log=None, download_recipe=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user