How can I change charset in SASS (SCSS)
Asked Answered
B

2

8

When working on web projects I'm using css preprocessor SASS with SCSS syntax. In the comments, I like to write what the following code does, I write comments in my language (in czech). Unfortunately, when you compile it throws me the error coding. I'm using for compilation app Koala.

Error msg by compilation:

 Error: Invalid US-ASCII character "\xC5" on line 7 
 of /Users/martinjinda/Documents/www/_welcome_screen/local/sass/main.scss 
 Use --trace for backtrace.

SCSS code:

 // ---------------------------------------------------------------------------
 // Import všech zdrojových souborů a následná kompilace do /css/main.css

 @import 'reset.scss';
 @import 'typo.scss';
 @import 'mixins.scss';
 @import 'layout.scss';
 @import 'content.scss';
Blinding answered 22/12, 2014 at 10:34 Comment(2)
possible duplicate of SASS prepends incorrect @charset ruleBuddhism
It worked, yes, thx. But I this option need set globaly for all my files and sub-files. I try added Encoding.default_external = "UTF-8" but isn't work.Blinding
B
15

Try @charset "UTF-8"; on the beginning of file, before any spaces, comments.

Blistery answered 22/12, 2014 at 10:53 Comment(1)
Well, you can always try writing your comments in english, just in case some other developer working on the code did not know Czech :)Blistery
G
0

Since LibSass is deprecated, you must use Dart Sass instead. With it, you don't need to specify the input encoding because default (and only supported until now) is "UTF-8". I tried you're Sass code with Dart Sass and no error is returned!

Giorgi answered 26/9, 2022 at 10:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.