'aabacx encode('utf- 'decode('latin- 'decoding worksresult is garbage unicodeencodeerror'charmapcodec can' encode character '\xc in position len( )len( ( no longer the same string encode('utf- ' ' \xc \ \xc \xa cx encode('utf- ' ' \xc \ \xc \ \xc \ \xc \xa cno longer same code points encode('latin- ' ' \xc \xe cx encode('latin- ' ' \xc \ \xc \xa ccuriouslythe original string may still be there after mismatch like this--if we encode the scrambled bytes back to latin- again (as -bit charactersand then decode properlywe might restore the original (in some contexts this can constitute sort of second chance if data is decoded wrong initially) 'aabacs encode('utf- 'decode('latin- 'unicodeencodeerror'charmapcodec can' encode character '\xc in position encode('utf- 'decode('latin- 'encode('latin- ' ' \xc \ \xc \xa cs encode('utf- 'decode('latin- 'encode('latin- 'decode('utf- ''aabacs encode('utf- 'decode('latin- 'encode('latin- 'decode('utf- '= true on the other handwe can use different encoding name to decodeas long as it' compatible with the format of the dataasciiutf- and latin- for instanceall format ascii text the same way'spamencode('utf 'decode('latin ''spam'spamencode('latin 'decode('ascii''spamit' important to remember that string' decoded value doesn' depend on the encoding it came from--once decodeda string has no notion of encoding and is simply sequence of unicode characters ("code points"hencewe really only need to care about encodings at the point of transfer to and from filess 'aabacs encode('utf- 'decode('utf- '= encode('latin- 'decode('latin- 'true tkinter tourpart