Skip to content
Browse files

Fix problem with files that contains utf8 symbols, in sublime console…

… was error:

File "./beautify_ruby.py", line 37, in beautify_buffer
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 671, in communicate
    return self._communicate(input)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0432' in position 395: ordinal not in range(128)
  • Loading branch information...
1 parent f7440f1 commit 73f772bc99c71178aa7d703837f4fc8209338bf1 @zsand zsand committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 beautify_ruby.py
View
2 beautify_ruby.py
@@ -34,7 +34,7 @@ def beautify_buffer(self):
working_dir = os.path.dirname(self.filename)
body = self.active_view.substr(self.buffer_region)
beautifier = subprocess.Popen(self.cmd(), shell=True, cwd=working_dir, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
- out = beautifier.communicate(body)[0].decode('utf8')
+ out = beautifier.communicate(body.encode("utf-8"))[0].decode('utf8')
if (out == "" and body != ""):
sublime.error_message("check your ruby interpreter settings")
return body

0 comments on commit 73f772b

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