djfz-2023-s464933/TaskG05/run.py
2024-01-18 15:17:03 +01:00

17 lines
449 B
Python

import sys
import binascii
def hex_to_utf8(hex_string):
hex_string = hex_string.replace(' ', '').replace('0x', '')
bytes_data = binascii.unhexlify(hex_string)
try:
utf8_text = bytes_data.decode('utf-8')
except UnicodeDecodeError:
utf8_text = bytes_data.decode('utf-8', errors='replace')
return utf8_text
for line in sys.stdin:
result_text = hex_to_utf8(line.strip())
print(result_text.encode('utf-8'))