I want to convert hex string to ASCII, and I tried multiple ways to convert it but it throws the same error every time.
The code:
hexFile = open('message', 'rb')
fileData = hexFile.read()
dataString = str(fileData, 'UTF-8')
bytes_object = bytes.fromhex(dataString)
ascii_string = bytes_object.decode("ASCII")
print(ascii_string)
The error:
line 130, in dataString = str(fileData, 'UTF-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 2: invalid continuation byte