The problem of encoding errors when writing programs in python 2.7 is the co-existence of Unicode type string and Str type string.
The "default" data type for text strings in python2.7 is Str type, which can only handle 8-bits ASCII characters correctly. But when it comes to handling non-ASCII characters, unicode type string may be used.
This results in a situation when a third-party package method return potentially two types of text string to dealing with both ASCII and non-ASCII type encoded data. An example is that in the a third-party method returns a Str type obj when there's only pure ASCII encoding input, but returns a Unicode type obj whenever it encounters a Non-ASCII encoding.
The users of the package may not be clear which of the text string type the package method will return, or even not aware of the possibility that two kinds of return types may exist.