Add unicode-capable IO to hooke.ui.commandline.
authorW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 06:31:00 +0000 (02:31 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 06:31:00 +0000 (02:31 -0400)
commit3ce07bb5d6effc9a788f5a1ef5e4eff8eb4a7174
tree8cd4e6a096c659b19585fe6ff07893600135a08b
parent2c413a7da6c94bcc4f5f0bb760abdfa711efcf93
Add unicode-capable IO to hooke.ui.commandline.

The previous implementation produced:
  $ python bin/hooke -c 'flat_filter_playlist'
  ...
  hooke> Traceback (most recent call last):
  ...
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xec'...

The new encoding detection functions in hooke.util.encoding came from
my libbe.util.encoding module for Bugs Everywhere.  From my original
BE commit (Tue 2008-11-25 15:47:19 -0500):

  get_encoding() is from Trac
    http://trac.edgewall.org/browser/trunk/trac/util/datefmt.py
    format_datetime()
  Trac has a BSD license
    http://trac.edgewall.org/wiki/TracLicense
  I don't know if such a small snippet requires us to "reproduce the
  above copyright" or where we need to reproduce it if it is needed.

  The stdout/stdin replacement code follows
    http://wiki.python.org/moin/ShellRedirectionFails

  References:
    http://wiki.python.org/moin/Unicode
    http://www.amk.ca/python/howto/unicode
    http://www.python.org/dev/peps/pep-0100/
hooke/plugin/convfilt.py
hooke/plugin/flatfilt.py
hooke/ui/commandline.py
hooke/util/encoding.py [new file with mode: 0644]
test/unicode_output.py [new file with mode: 0644]