CoffeeScript-Sublime-Plugin icon indicating copy to clipboard operation
CoffeeScript-Sublime-Plugin copied to clipboard

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

Open masonmark opened this issue 11 years ago • 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

masonmark avatar Nov 27 '12 07:11 masonmark

I had this problem too. I was adding this:

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

to CoffeeScript.py line 83. profit

lavrton avatar Nov 29 '12 09:11 lavrton

I'll incorporate the above change soon.

Xavura avatar Nov 29 '12 13:11 Xavura