diff --git a/request_llms/bridge_moonshot.py b/request_llms/bridge_moonshot.py index e1b3cd4842..20983fd9f8 100644 --- a/request_llms/bridge_moonshot.py +++ b/request_llms/bridge_moonshot.py @@ -31,7 +31,7 @@ def __converter_file(self, user_input: str): files.append(f) for file in files: if file.split('.')[-1] in ['pdf']: - with open(file, 'r') as fp: + with open(file, 'r', encoding='utf8') as fp: from crazy_functions.crazy_utils import read_and_clean_pdf_text file_content, _ = read_and_clean_pdf_text(fp) what_ask.append({"role": "system", "content": file_content}) diff --git a/themes/common.py b/themes/common.py index dc9b0575b9..f3ee23d727 100644 --- a/themes/common.py +++ b/themes/common.py @@ -29,7 +29,7 @@ def minimize_js(common_js_path): os.remove(old_min_js) # use rjsmin to minimize `common_js_path` c_jsmin = rjsmin.jsmin - with open(common_js_path, "r") as f: + with open(common_js_path, "r", encoding='utf-8') as f: js_content = f.read() if common_js_path == "themes/common.js": js_content = inject_mutex_button_code(js_content) @@ -38,7 +38,7 @@ def minimize_js(common_js_path): sha_hash = hashlib.sha256(minimized_js_content.encode()).hexdigest()[:8] minimized_js_path = common_js_path + '.min.' + sha_hash + '.js' # save to minimized js file - with open(minimized_js_path, "w") as f: + with open(minimized_js_path, "w", encoding='utf-8') as f: f.write(minimized_js_content) # return minimized js file path return minimized_js_path