The UnicodeError
exception – raised when a Unicode-related encoding or decoding error occurs. It is a subclass of ValueError.
The UnicodeError has attributes that describe an encoding or decoding error.
- encoding – the name of the encoding that raised the error.
- reason – a string describing the specific codec error.
- object – the object the codec was attempting to encode or decode.
- start – the first index of invalid data in the object.
- end – the index after the last invalid data in the object.
See the output of this snippet to analyze the attributes' values.