llmora / zip_parser

Parse a ZIP file and print out information about its various sections
GNU General Public License v2.0
0 stars 0 forks source link

Fails with non-basic characters in filenames, such as ♫ #2

Open ProximaNova opened 1 year ago

ProximaNova commented 1 year ago
>python zip_parser.py file.zip > parse.txt
Traceback (most recent call last):
  File "zip_parser.py", line 250, in <module>
    parse_file()
  File "zip_parser.py", line 130, in parse_file
    print("[*] Filename: %s" % filename)
  File "C:\[...]\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u266b' in position 47: character maps to <undefined>

>

"\u266b" decodes to "♫". The character "♫" is in a filename of a file which is compressed in "file.zip".