Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from jedy/master

Fixes to deal with Chinese characters
  • Loading branch information...
commit 2a4eca1143c0bc9b3b8a7bede2fd742b3f83969b 2 parents d4efd2c + a350b4a
@witsch authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 Tidy.py
View
8 Tidy.py
@@ -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))
+
Please sign in to comment.
Something went wrong with that request. Please try again.