[XML-SIG] outputting non-ascii strings

Martin v. Loewis martin@v.loewis.de
22 May 2002 21:02:31 +0200


"Juergen Hermann" <jh@web.de> writes:

> Explicit: stream.write(u.encode('utf-8'))
> 
> Implicit: Use codecs.lookup('utf-8') to get reader/writer wrappers, then 
> you say utf8_stdout = utf8_wrapper(sys.stdout)

Since Python 2.2, it is better to use codecs.getwriter("utf-8"), since
that saves the trouble of knowing in which order the result of .lookup
is.

Regards,
Martin