BC44 / Cross-Seed-AutoDL

Scans files and finds cross-seedable torrents via Jackett
MIT License
137 stars 19 forks source link

russian characters in file name are <undefined> #14

Closed Jerrk closed 3 years ago

Jerrk commented 3 years ago

one of my folders has "Михалёв" in its name. trying to search for a match does not work and i get this error.

--- Logging error ---
Traceback (most recent call last):
  File "C:\Python\Python391\lib\logging\__init__.py", line 1082, in emit
    stream.write(msg + self.terminator)
  File "C:\Python\Python391\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 155-161: character maps to <undefined>
Call stack:
  File "Cross-Seeding-NFO\CrossSeedAutoDL.py", line 399, in <module>
    main()
  File "Cross-Seeding-NFO\CrossSeedAutoDL.py", line 367, in main
    logger.info(info + f'/ {os.path.basename(path)}')
Message: 'Searching for *********************'
Arguments: ()
0 matched of 0 results.

The script didnt crash but rather kept going which is real nice but i thought i should bring it to your attention anyways. maybe add support for such characters or maybe skip them in the search idk

thanks for the great script!

BC44 commented 3 years ago

I'll have to look into this. Thanks

BC44 commented 3 years ago

So it was only the logger which was failing to log the file name being searched, which is strange since I was under the assumption that utf-8 encodings were implicit in python 3. Regardless, I've added a small fix in 4290305a6dfe27cabeab493ba37a4e1ac0c0a679