Ben Spiller added the comment:
I'm proposing that str.encode() should _not_ throw a 'decode' exception for
non-ascii characters and be effectively a no-op, to match what it already does
for ascii characters - which therefore shouldn't break behavior anyone will be
depending on. This could be achieved by passing the encoding parameter through
to the implicit decode() call (which is where the exception is coming from it
appears), rather than (arbitrarily and surprisingly) using "ascii" (which of
course sometimes works and sometimes doesn't depending on the input string)
Does that make sense?
If someone can find the place in the code (sorry I tried and failed!) where
str.encode('utf-8') is resulting in an implicit call to the equivalent of
decode('ascii') (as suggested by the exception message) I think it'll be easier
to discuss the details
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26369>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com