On 2020-08-28 08:30, Richard Damon wrote: > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage.
For English speaking Americans. > Python2 handled that sort of case quite easily. Python 3 on the other > hand, will have issue converting the byte message to a string, since > there isn't a single encoding that you could use for all of it all the > time. This being 'fussier' does make sure that the program is handling > all the text 'properly', and would be helpful if some of the patterns > being checked for contained 'extended' (non-ASCII) characters. > > One possible solution in Python3 is to decode the byte string using an > encoding that allows all 256 byte values, so it won't raise any encoding > errors, just give your possibly non-sense characters for non-ASCII text. Or simply handle the errors in the way that makes sense for your requirements. Check the section on error handling here: https://www.askpython.com/python/string/python-encode-and-decode-functions -- D'Arcy J.M. Cain Vybe Networks Inc. A unit of Excelsior Solutions Corporation - Propelling Business Forward http://www.VybeNetworks.com/ IM:da...@vybenetworks.com VoIP: sip:da...@vybenetworks.com
signature.asc
Description: OpenPGP digital signature
-- https://mail.python.org/mailman/listinfo/python-list