Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use default if encoding of view is undefined

  • Loading branch information...
commit a350b4ae541f05b9ee20f2a7525496a67c417dbe 1 parent 457f6ef
jedy jedy authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 Tidy.py
7 Tidy.py
@@ -32,8 +32,11 @@ def run(self, edit):
32 32 setup()
33 33 view = self.view
34 34 region = Region(0L, view.size())
35   - source = StringIO(view.substr(region).encode(view.encoding()))
  35 + encoding = view.encoding()
  36 + if not encoding or encoding == u'Undefined':
  37 + encoding = view.settings().get('default_encoding')
  38 + source = StringIO(view.substr(region).encode(encoding))
36 39 output = StringIO()
37 40 PythonTidy.tidy_up(source, output)
38   - view.replace(edit, region, output.getvalue().decode(view.encoding()))
  41 + view.replace(edit, region, output.getvalue().decode(encoding))
39 42

0 comments on commit a350b4a

Please sign in to comment.
Something went wrong with that request. Please try again.