Skip to content

Commit

Permalink
Encode the output to UTF-8 before writing to file
Browse files Browse the repository at this point in the history
Having run pyScss with `--watch`, it died with:
```
  File "/usr/local/lib/python2.7/dist-packages/scss/tool.py", line 254, in compile
    dest_file.write(self.css.compile(scss_file=src_path))
UnicodeEncodeError: 'ascii' codec can't encode character u'\uf0d7' in position 816: ordinal not in range(128)
```
Encoding to UTF-8, assuming that's what everyone wants, before writing the file, solves it.
  • Loading branch information
kernc committed Jan 6, 2015
1 parent f26e994 commit e90108a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scss/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def compile(self, src_path):

print("Compiling %s => %s" % (src_path, dest_path))
dest_file = open(dest_path, 'w')
dest_file.write(self.css.compile(scss_file=src_path))
dest_file.write(self.css.compile(scss_file=src_path).encode('utf-8'))

def on_moved(self, event):
super(ScssEventHandler, self).on_moved(event)
Expand Down

0 comments on commit e90108a

Please sign in to comment.