Skip to content

Commit

Permalink
Merge pull request #7 from jedy/master
Browse files Browse the repository at this point in the history
Fixes to deal with Chinese characters
  • Loading branch information
witsch committed Mar 12, 2013
2 parents d4efd2c + a350b4a commit 2a4eca1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Tidy.py
Expand Up @@ -32,7 +32,11 @@ def run(self, edit):
setup()
view = self.view
region = Region(0L, view.size())
source = StringIO(view.substr(region))
encoding = view.encoding()
if not encoding or encoding == u'Undefined':
encoding = view.settings().get('default_encoding')
source = StringIO(view.substr(region).encode(encoding))
output = StringIO()
PythonTidy.tidy_up(source, output)
view.replace(edit, region, output.getvalue())
view.replace(edit, region, output.getvalue().decode(encoding))

0 comments on commit 2a4eca1

Please sign in to comment.