[TxMt] Python unicode error (was: r8839 (Python)) [reposting]

Alexey Blinov nilcolor at gmail.com
Tue Jun 3 10:06:17 UTC 2008


> Only for clarification:
> If I write a new python script my head should be à la:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import sys
> import codecs
>
> sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
> sys.stdin  = codecs.getreader('utf-8')(sys.stdin)
> ....
>
> and then I do not need unicode(foo, 'UTF-8') and foo.encode('UTF-8') (?)
>
> Thanks,
> --Hans
>

Clear and good description! Thanks Hans!
Its worth to be stored in my DevonThink db *)

Alexey


More information about the textmate mailing list