You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

19 lines
401 B

import sys
import char_encodings
encoded = bytes.fromhex(sys.argv[1])
decodings = {}
for encoding in char_encodings.encodings:
try:
decoded = encoded.decode(encoding)
except UnicodeDecodeError:
continue
if decoded not in decodings: decodings[decoded] = []
decodings[decoded].append(encoding)
for decoded, encodings in decodings.items():
print(f'{",".join(encodings)}: {repr(decoded)}')