From 9b5b4dfab360c86cd123aae631cfd8e3f609e37f Mon Sep 17 00:00:00 2001 From: Ethan Chapman Date: Mon, 30 Sep 2024 16:40:01 -0400 Subject: [PATCH] Specify UTF-8 encoding in Python script (#808) * Specify UTF-8 encoding in Python script Fixes error on Windows * Use regular open instead of io.open Works just as well, no need for an extra import * Fix file names * Update update_readme.py --------- Co-authored-by: Terence Eden --- update_readme.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update_readme.py b/update_readme.py index 59f00f70..d95f8f51 100644 --- a/update_readme.py +++ b/update_readme.py @@ -109,7 +109,7 @@ check_table += "" readme_summary_text = f"There are currently {len(svg_list)} icons and the average size is _under_ {round(total_bytes / len(svg_list))} bytes!" # Replace the table in README with the new one -with open('README.md','r+') as f: +with open('README.md','r+', encoding="utf-8") as f: file = f.read() file = re.sub(r"(?s).*?
", readme_table, file) @@ -122,7 +122,7 @@ with open('README.md','r+') as f: print(f"README.md updated with {len(svg_list)} icons.") # Replace the tables in the REFERENCE document -with open('REFERENCE.md','r+') as f: +with open('REFERENCE.md','r+', encoding="utf-8") as f: file = f.read() file = re.sub(r"(?s)-\|-\|-.*", reference_table, file) @@ -135,7 +135,7 @@ with open('REFERENCE.md','r+') as f: print(f"REFERENCE.md updated.") # Replace the table in the CHECK document -with open('CHECK.html','r+') as f: +with open('CHECK.html','r+', encoding="utf-8") as f: file = f.read() file = re.sub(r"(?s).*?
", check_table, file)