question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sass compiler ignoring @charset

See original GitHub issue

The attached ZIP (SCSSS.zip) has a SCSS file named inow.scss. The file inow.css has a @charset 'UTF-8'; directive. There’s an import named _grid.scss. Later, I also included @charset in imports too. In an environment with default US-ASCII charset, SASS compiler won’t compile it. It generates the following error:

Error: Invalid US-ASCII character "\xC3"
        on line 106 of includes/_grids.scss
        from line 26 of inow.scss
  Use --trace for backtrace.

The problem is on line 106 of includes/_grids.scss. It has a letter with an accent (in a comment). I could reproduce it locally in a Windows machine by using -E US-ASCII option. The command-line used to reproduce was: sass --scss -t expanded -E US-ASCII inow.scss inow.css.

I believe the compiler should respect the @charset.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
nex3commented, Jul 14, 2017

Sass uses @charset rules in the input files to determine the character set of those files. However, it doesn’t output a @charset rule unless the output file actually has non-ASCII characters, since it doesn’t do anything otherwise.

0reactions
ethernideecommented, Sep 17, 2020

Sorry, seems like I was mistaken. It’s Ruby Sass 3.7.4 issue,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jekyll Sass converter ignores @charset - Stack Overflow
Jekyll's Sass converter is ignoring the @charset "UTF-8"; declaration at the very beginning of style.scss file after compiling to css.
Read more >
Compile Sass to CSS with sassc so as to alphabetize selectors and ...
Attempting to match CSS compiling results of a themer we are working with— alphabetical selectors and UTF-8 encoding. sass compile “alphabetical” special ...
Read more >
Sass converter ignores @charset ?
Sass converter ignores @charsetlink Sass keeps the @charset declaration only if needed (non-ASCII character in your file).
Read more >
Dart Sass Command-Line Interface
When compiling whole directories, Sass will ignore partial files whose names begin ... This flag tells Sass never to emit a @charset declaration...
Read more >
Theme files are shipped with the UTF-8 encoding starting with ...
In v20.2 we migrated to SASS. The SASS compiler always creates files with the UTF-8 encoding. If a file has non-ASCII characters, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found