Encode differences between idle python and python

Neil Cerutti horpner at yahoo.com
Wed Oct 11 14:40:14 CEST 2006

On 2006-10-10, pretoriano_2001 at hotmail.com <pretoriano_2001 at hotmail.com> wrote:
> Gabriel, Peter:
> Many thanks for your clear answers!! Best regards.

Something I've been working on is currently using the following

 # Create some string of non-ASCII text in ISO 8859-1.
 some_string = ''.join(chr(a) for a in range(0xc0, 0xdf)).decode('ISO 8859-1')
 # Print it to stdout, converting to the terminal's encoding, replacing
 #  unprintable characters with '?'.
 print some_string.encode(sys.stdout.encoding, 'replace')

Neil Cerutti
That's the biggest laughingstock I've ever heard of in my life.
--Trot Nixon

More information about the Python-list mailing list