Skip to content

Commit 4648a61

Browse files
committed
fix: 🚨 use utf-8 encoding
1 parent ff159d1 commit 4648a61

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/*
2+
dist/*
3+
*.bat
4+
*.spec

main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from fontTools.ttLib import TTFont
44
import os
55

6+
67
def open_font():
78
file_path = filedialog.askopenfilename(defaultextension=".ttf",
89
filetypes=[("Font", "*.ttf *.otf"),
@@ -11,7 +12,7 @@ def open_font():
1112
font = TTFont(file_path)
1213
characters = font['cmap'].getBestCmap().keys()
1314
valid_characters = set()
14-
with open('Unicode/UnicodeData.txt', 'r') as f:
15+
with open('Unicode/UnicodeData.txt', 'r', encoding='utf-8') as f:
1516
lines = f.readlines()
1617
index = 0
1718
while index < len(lines):
@@ -30,7 +31,7 @@ def open_font():
3031
valid_characters.add(code)
3132
index += 1
3233
blocks_info = {}
33-
with open('Unicode/Blocks.txt', 'r') as f:
34+
with open('Unicode/Blocks.txt', 'r', encoding='utf-8') as f:
3435
for line in f:
3536
if line.startswith('#') or not line.strip():
3637
continue
@@ -90,7 +91,7 @@ def open_font():
9091
unicode_text_box.grid(row=3, column=0, padx=10)
9192

9293
unicode_scroll_y = tk.Scrollbar(root, orient='vertical',
93-
command=unicode_text_box.yview)
94+
command=unicode_text_box.yview)
9495
unicode_scroll_y.grid(row=3, column=1, sticky='ns')
9596
unicode_text_box.config(yscrollcommand=unicode_scroll_y.set)
9697

@@ -101,7 +102,7 @@ def open_font():
101102
custom_text_box.grid(row=3, column=2, padx=10)
102103

103104
custom_scroll_y = tk.Scrollbar(root, orient='vertical',
104-
command=custom_text_box.yview)
105+
command=custom_text_box.yview)
105106
custom_scroll_y.grid(row=3, column=3, sticky='ns')
106107
custom_text_box.config(yscrollcommand=custom_scroll_y.set)
107108

0 commit comments

Comments
 (0)