I recently upgraded to Ruby 1.9 and I can no longer compile anything with Sass.
I've seen solutions that state if I place
@charset "utf-8";
at the top of my .sccs file, it will fix it. However I'm still getting an error. Here's the full traceback
I've also tried removing any non-ascii characters from my CSS file, creating a new one, etc. It just won't compile. Any tips?
Traceback:
Sass is watching for changes. Press Ctrl-C to stop.
/home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:496:in `encode': transcoding not supported (from ASCII-8BIT to UTF-8) (ArgumentError)
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:496:in
_enc' from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:515:in
rescue in block (1 levels) in 'from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:508:in `block (1 levels) in '
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:472:in `yield'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:472:in `default'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:472:in `block in check_sass_encoding'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:471:in `each'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:471:in `find'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/util.rb:471:in `check_sass_encoding'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/engine.rb:349:in `check_encoding!'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/engine.rb:316:in `_to_tree'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/engine.rb:291:in `_render'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/engine.rb:238:in `render'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:319:in `update_stylesheet'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:169:in `block in update_stylesheets'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:167:in `each'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:167:in `update_stylesheets'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:214:in `watch'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/plugin.rb:111:in `method_missing'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/exec.rb:408:in `watch_or_update'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/exec.rb:294:in `process_result'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/exec.rb:41:in `parse'
from /home/webdev/.gem/repository/gems/sass-3.1.1/lib/sass/exec.rb:21:in `parse!'
from /home/webdev/.gem/repository/gems/sass-3.1.1/bin/sass:8:in `'
from /home/webdev/.gem/repository/bin/sass:19:in `load'
from /home/webdev/.gem/repository/bin/sass:19:in `'
To complete @nex3 answer you can
Open the config.rb
file and add:
Encoding.default_external = "UTF-8"
It looks like somehow your Ruby environment is set up to load the Sass source code as ASCII-8BIT
, a.k.a. BINARY
. This is probably because you're either passing the -Kn
flag to the Ruby process, or setting Encoding.default_external
to Encoding::BINARY
somewhere in your code before Sass is loaded. Undo this, and Sass should work.
I don't know exactly the core of the issue, but it seems there were some problems with Ruby 1.9.0 (the version available on apt for this Ubuntu box) and encoding.
To solve the issue, I used https://rvm.io which is a helper to download and compile Ruby from Git, giving me the latest version. After running this, sass compiles fine and everything is swell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With