SublimeJSCSFormatter
SublimeJSCSFormatter copied to clipboard
UnicodeDecodeError invalid start byte
Hi, i got this message unser windows:
Using node.js path on 'windows': C:/Program Files/nodejs/node.exe
Using jscs path on 'windows': C:/Program Files/nodejs/jscs
Unexpected error(<class 'UnicodeDecodeError'>): 'utf-8' codec can't decode byte 0x8a in position 41: invalid start byte
error: 'utf-8' codec can't decode byte 0x8a in position 41: invalid start byte
My configuration is:
- iojs 1.6+
- jscs 1.12.0
Hi. Thanks for reporting. What does your jscsrc look like?
{
"preset": "jquery",
"validateIndentation": 2
}
Thanks for the details. Just confirming, are you able to use jscs on iojs 1.6 successfully outside of the plugin?
Could you supply a small snippet of code that reproduces the error?
Trying to rule out the environment, if possible.
Yes, it works outside.
I just tried to run the formatter on a file (the same used to test jscs
outside the plugin) and got this error.
Confirm this error Win 8.1, [email protected], [email protected]
Hi,
I am using [email protected]
I am developing in a remote located project (using samba)
When I try to run the Sublime JSCSFormatter directly in the remote files, I got this message also:
Using node.js path on 'windows': node.exe
Using jscs path on 'windows': %APPDATA%/npm/node_modules/jscs/bin/jscs
Using configuration from C:/Users/vmlazaro/Documents/jscs_test/.jscsrc
Unexpected error(<class 'UnicodeDecodeError'>): 'utf-8' "codec can't decode byte 0xa2 in position 98: invalid start byte"
error: 'utf-8' "codec can't decode byte 0xa2 in position 98: invalid start byte"
On the other hand, if I move the project to my computer and I run it locally, the plugin do it perfectly.
Do you know how I can solve this problem?
Thanks!
Thanks for reporting! Seems like there's a file that has a non utf8 file encoding. Maybe the OS of the remote server encodes the file differently (might be a windows box)?
A possible solution:
We could swap the encode/decode formats based on the OS: windows-1252 (on windows) and utf8 on mac/linux. That would happen in this region: https://github.com/TheSavior/SublimeJSCSFormatter/blob/master/JSCS-Formatter.py#L147
Mind trying that modification out locally and seeing if it works? Would be hard for us to recreate your scenario otherwise.
Hi,
I am using [email protected]
I am developing in a remote located project (using samba)
When I try to run the Sublime JSCSFormatter directly in the remote files, I got this message also:
Using node.js path on 'windows': node.exe Using jscs path on 'windows': %APPDATA%/npm/node_modules/jscs/bin/jscs Using configuration from C:/Users/vmlazaro/Documents/jscs_test/.jscsrc Unexpected error(<class 'UnicodeDecodeError'>): 'utf-8' "codec can't decode byte 0xa2 in position 98: invalid start byte" error: 'utf-8' "codec can't decode byte 0xa2 in position 98: invalid start byte"
On the other hand, if I move the project to my computer and I run it locally, the plugin do it perfectly.
Do you know how I can solve this problem?
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/TheSavior/SublimeJSCSFormatter/issues/15#issuecomment-167781358 .