From c023695e7138fb6ce8ed02bac5c95006715a5bcd Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Tue, 13 Feb 2018 18:28:48 +0530 Subject: [PATCH] encode utf-8 for help database --- frappe/utils/help.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/utils/help.py b/frappe/utils/help.py index 45971820c0..df6bfb884a 100644 --- a/frappe/utils/help.py +++ b/frappe/utils/help.py @@ -15,6 +15,8 @@ from bs4 import BeautifulSoup import jinja2.exceptions from six import text_type +import io + def sync(): # make table print('Syncing help database...') @@ -135,9 +137,9 @@ class HelpDatabase(object): for fname in files: if fname.rsplit('.', 1)[-1] in ('md', 'html'): fpath = os.path.join(basepath, fname) - with open(fpath, 'r') as f: + with io.open(fpath, 'r', encoding = 'utf-8') as f: try: - content = frappe.render_template(text_type(f.read(), 'utf-8'), + content = frappe.render_template(f.read(), {'docs_base_url': '/assets/{app}_docs'.format(app=app)}) relpath = self.get_out_path(fpath)