Skip to content

Commit

Permalink
font-patcher: State encoding of datafile
Browse files Browse the repository at this point in the history
[why]
Some user reported a unicode decoding issue.

[how]
Usually it should work but when the system has some strange setting the
datafile might be interpreted as something else (not utf8).

When the file is opened as binary it should be decoded as utf*.

Possibly fixes: #1761

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Jan 15, 2025
1 parent 34a1499 commit c1859cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def fetch_glyphnames():
""" Read the glyphname database and put it into a dictionary """
try:
glyphnamefile = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), 'glyphnames.json'))
with open(glyphnamefile, 'r') as f:
with open(glyphnamefile, 'rb') as f:
namelist = json.load(f)
return { int(v['code'], 16): k for k, v in namelist.items() if 'code' in v }
except Exception as error:
Expand Down

0 comments on commit c1859cf

Please sign in to comment.