20 lines
401 B
Python
20 lines
401 B
Python
|
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)}')
|