homoglyphs icon indicating copy to clipboard operation
homoglyphs copied to clipboard

Forcing UTF-8 when reading languages.json, updated confusables.json

Open clydejallorina opened this issue 2 years ago • 0 comments

Fixed a bug where attempting to read from languages.json can raise an error in Windows due to it having non-CP1252 characters. Forcing it to read the file as UTF-8 fixes the issue.

  File "D:\homoglyphs_fork\core.py", line 112, in detect
    data = json.load(f)
  File "D:\Program Files\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "D:\Program Files\Python39\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 78: character maps to <undefined>

Also updated confusables.json to the latest version (Version 15.0.0, released 2022-08-26)

clydejallorina avatar Sep 17 '22 02:09 clydejallorina