Result Size: 625 x 571
demo_ref_string_encode2.py:
x
 
txt = "My name is Ståle"
print(txt.encode(encoding="ascii",errors="backslashreplace"))
print(txt.encode(encoding="ascii",errors="ignore"))
print(txt.encode(encoding="ascii",errors="namereplace"))
print(txt.encode(encoding="ascii",errors="replace"))
print(txt.encode(encoding="ascii",errors="xmlcharrefreplace"))
print(txt.encode(encoding="ascii",errors="strict"))
C:\Users\My Name>python demo_string_encode2.py
b'My name is St\\xe5le'
b'My name is Stle'
b'My name is St\\N{LATIN SMALL LETTER A WITH RING ABOVE}le'
b'My name is St?le'
b'My name is Ståle'
Traceback (most recent call last):
  File "demo_ref_string_encode2,py", line 8, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe5\ in position 13: ordinal not in range(128)