witsch/SublimePythonTidy — pull request #5 by mdornseif (2012-05-28 05:37:07+00:00)
Title: Fix encoding issues with StringIO 

The current code took the (unicode) view and stuffed
it into a `StringIO` byte stream. The resulting encoding being
seen by PythonTidy was dependent on the configuration of the
system the code was running on and on implementation
details in StringIO.

It than read the result (a bytestream) and wrote it into
the (unicode) view. Again with indeterminable results
based on the default encodings of the host system.

For me opening the file http://filez.foxel.org/211a0I1L3t3n2I3P1L25
and pressing CTRL-ALT-CMD-T worked once but pressing it twice
resulted in an `UnicodeException`.

https://github.com/witsch/SublimePythonTidy/issues/1 shows
the same issue and https://github.com/do3cc/SublimePythonTidy/commit/efc88be
seems to be an attempt to fix it.

This changeset ensures that

a) views are treated as unicode
b) StringIOs are treated as byte stream

This fixes witsch/SublimePythonTidy#1

PythonTidy also has a bunch of (not fixed so far) unicode issues,
e.g. see mdornseif/PythonTidy#1