I have a rails app that is getting a weird error when I try to run rake assets:precompile. It looks like this:
rake aborted!
Invalid US-ASCII character "\xE2"
(in /Users/lee/Code/draper/app/assets/stylesheets/application.css.scss)
(sass):9
I'm not sure where an invalid character might have slipped into my code. I'm using Twitter Bootstrap (boostrap-sass gem) and my bootstrap_and_overrides.css.scss file seems to be the culprit. I've already tried recreating this file from scratch in text mate to get any weird characters out and that didn't work. The only thing that seems to work is adding this to the top of my bootstrap_and_overrides.css.scss:
@charset "UTF-8";
That allows me to run rake assets:precompile and then deploy to Heroku, but that seems like a hack and a dirty fix. I can deploy other apps to Heroku that use bootstrap-sass just fine and Heroku is able to run rake assets:precompile when deploying. Right now the only way to get around it is to include the @charset "UTF-8"; and then run rake assets:precompile locally before deploying to Heroku so that it skips that step during deployment.
I can't figure out where I went wrong with this.
Check your CSS files. The character \xE2 usually correlates to a double quote character that's not part of the ASCII character set. In an editor they often look like a more slanted double quote. “mystring” vs "mystring"
Using the @charset declaration isn't a hack, but if you don't need to be using a UTF-8 character, you're probably better off removing it.
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