sustained/CoffeeScript-Sublime-Plugin

'Display JavaScript' command doesn't work with non-ASCII characters

Opened this issue · 2 comments

Valid CoffeeScript won't compile using the 'Display JavaScript' command if there are Japanese or other non-ASCII characters in the file. Instead an error is logged and blank window appears.

This code compiles and displays fine:

foo = "It works with ASCII text."

But, if you add some non-ASCII to the mix, like this, it doesn't work anymore:

foo = "It works with ASCII text."
bar = "日本語だったらダメだ。"

The error printed to console is:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./CoffeeScript.py", line 88, in run
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 58: ordinal not in range(128)

The version I am using is the current one from Package Control: v2012.07.19.12.47.26; xavura.github.com/CofffeeScript-Sublime-Plugin

I had this problem too. I was adding this:

res['out'] = res['out'].decode('utf8')

to CoffeeScript.py line 83. profit

I'll incorporate the above change soon.