Robert Latest wrote: > Here's a test snippet... > > import sys > for k in sys.stdin: > print '%s -> %s' % (k, k.decode('iso-8859-1')) > > ...but it barfs when actually fed with iso8859-1 characters. How is this > done right?
it's '%s -> %s' % (byte string, unicode string) that barfs. try doing import sys for k in sys.stdin: print '%s -> %s' % (repr(k), k.decode('iso-8859-1')) instead, to see what's going on. </F> -- http://mail.python.org/mailman/listinfo/python-list