b'Learn pyth\\xf6n!' b'Learn pythn!' b'Learn pyth\\N{LATIN SMALL LETTER O WITH DIAERESIS}n!' b'Learn pyth?n!' b'Learn pythön!' Traceback (most recent call last): File "file_name.py", line 8, in <module> print(txt.encode("ascii", "strict")) UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 10: ordinal not in range(128)