Skip to content

Commit

Permalink
Specify UTF-8 encoding in Python script (#808)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Eiim and edent authored Sep 30, 2024
1 parent 3762d3a commit 9b5b4df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
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)<table>.*?</table>", readme_table, file)
Expand All @@ -122,7 +122,7 @@
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)
Expand All @@ -135,7 +135,7 @@
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)<table>.*?</table>", check_table, file)
Expand Down

0 comments on commit 9b5b4df

Please sign in to comment.