7 Jan
2016
7 Jan
'16
12:09 p.m.
On 7 January 2016 at 11:53, Chris Angelico
3) Encode as ASCII, and let any errors bubble up.
4) Encode as ASCII and catch UnicodeEncodeError and re-raise as a TypeError "Unicode string supplied without an explicit encoding". IMO, the underlying encoding errors are very user-unfriendly, and should nearly always be caught internally and replaced with something more user friendly. Most of the user confusion I see from Unicode issues could probably be significantly alleviated if the user was presented with something better than a raw (en/de)coding error and traceback. Paul