Tue 11 Oct 2005

Unicode

Ooh, fun with printing Unicode in Python! Thank you to Christoph Görn for pointing out that my ab.py tool chokes when printing Unicode characters from Address Book records.

The reason and solution are ably explained here: Python's output stream is defaulting to ASCII encoding.

A fix:
import codecs, sys
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)

Posted at 2005-10-11 10:28:13 by RichardLink to Unicode
Comments, trackbacks.

Google
Web holygoat.co.uk
  • richard is: