smfoote/Swiffer.js — pull request #6 by thefourtheye (2013-07-26 15:16:25+00:00)
Title: Fix for 'Unknown encoding' error

In Ubuntu 13.04, swiffer doesn't seem to be working out of the box.

1) When I executed the example, ```bin/swiffer examples/jsControl.tl```, it failed with
```
[Error: Unknown encoding]
Cannot call method 'substr' of undefined
```
readFileSync returns a Buffer and it has a toString method which accepts encoding as one of the optional parameters. This seems to be working fine.

2) When readFileSync fails, we display error in the console and still trying to do 'clean'. If there is an error, we shouldn't do the cleaning. So moving the line which cleans to the try..catch block.