Files
software-testing/decode.py
2025-04-03 16:57:05 +03:00

19 lines
566 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Упрощяет копипасту из отчётов с поломанной кодировкой"""
def fix_encoding(text):
fixed_text = text.encode("latin1").decode("windows-1251")
fixed_text = fixed_text.replace("ј", "ё")
fixed_text = fixed_text.replace("ѕ", "<<")
fixed_text = fixed_text.replace("ї", ">>")
return fixed_text
if __name__ == "__main__":
while True:
corrupted_text = input("Введите искажённый текст: ")
print()
print(fix_encoding(corrupted_text))
print()