Python2 throws an exception while encoding the characters which are outside the range of 128 where as python3 does successfully. Also why the exception throws as UnicodeDecodeError instead of UnicodeEncodeError.Can some please let me know the reason.
python2:
data = 'À'
data.encode('cp1252')
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
Python3:
data = 'À'
data.encode('cp1252')
output: b'\xc0'