Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why can't sass handle emoji? #1170

Closed
dunn opened this issue Mar 13, 2014 · 4 comments
Closed

why can't sass handle emoji? #1170

dunn opened this issue Mar 13, 2014 · 4 comments

Comments

@dunn
Copy link

dunn commented Mar 13, 2014

For my own inscrutable purposes I want to do this:

h1::before {
    content: "👻"
}

sass fails to compile with this error:

error sass/screen.scss (Line 56: Invalid US-ASCII character "\xF0")

I can write that as regular CSS and it renders fine, at least in Safari.

@Snugug
Copy link

Snugug commented Mar 13, 2014

What version of Sass are you using? Using Sass 3.3.x and Sass 3.2.x, this compiles just fine and adds the appropriate @charset "UTF-8";. Libsass fails, but gracefully. Check out this SassMeister that shows it rocking fine (recommend w/Chrome and the Chromoji extension)

@dunn
Copy link
Author

dunn commented Mar 13, 2014

I've got sass 3.3.2 and Compass 0.12.3. Here's the sass --trace:

sass/screen.scss:56: Invalid US-ASCII character "\xF0" (Sass::SyntaxError)
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/engine.rb:440:in `block in check_encoding!'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:732:in `rescue in block in check_encoding'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:729:in `block in check_encoding'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:728:in `each'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:728:in `each_with_index'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:728:in `check_encoding'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/util.rb:782:in `check_sass_encoding'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/engine.rb:439:in `check_encoding!'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/engine.rb:406:in `_to_tree'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/engine.rb:274:in `render'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/exec.rb:384:in `process_result'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/exec.rb:43:in `parse'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/lib/sass/exec.rb:22:in `parse!'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/sass-3.3.2/bin/sass:13:in `<top (required)>'
    from /usr/local/opt/ruby/bin/sass:23:in `load'
    from /usr/local/opt/ruby/bin/sass:23:in `<main>'

@nex3
Copy link
Contributor

nex3 commented Mar 13, 2014

Sass doesn't know what encoding your file is using. You need to either set your computer's default encoding to UTF-8 (the specifics of this depend on your operating system), or include @encoding "UTF-8"; at the top of your file.

@nex3 nex3 closed this as completed Mar 13, 2014
@dunn
Copy link
Author

dunn commented Mar 13, 2014

Adding @charset "UTF-8"; worked; I had put that in my _base.scss and thought it would import into screen.scss for some reason.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants