cjwatson: (Default)
Col ([personal profile] cjwatson) wrote in [personal profile] ewx 2007-12-18 10:20 am (UTC)

This seems to restore things to sanity, though I'm not convinced I've got the decode nonsense right (however, it works for me):

import sys

# Avoid having to do .encode('UTF-8') everywhere. This is a pain; I wish
# Python supported something like "sys.stdout.encoding = 'UTF-8'".
def fix_stdout():
    import codecs
    sys.stdout = codecs.EncodedFile(sys.stdout, 'UTF-8')
    def null_decode(input, errors='strict'):
        return input, len(input)
    sys.stdout.decode = null_decode

fix_stdout()

Post a comment in response:

(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org