(:
This commit is contained in:
18
decode.py
Normal file
18
decode.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Упрощяет копипасту из отчётов с поломанной кодировкой"""
|
||||
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user