UTF-8 encoding not working
See original GitHub issueAn empty scss stylesheet containing just this:
a:after { content: ' ›'; }
Compiles to this:
a:after { content: ' ÔÇ║'; }
So, not good. Even when I add @charset "utf-8";
to the top of my scss, it still outputs the same stuff. My scss really is saved as UTF-8, but without a BOM though (using Brackets as my editor, there’s no option for it, as far as I’m aware).
Escaping it:
a:after { content: ' \203a'; }
Outputs:
a:after { content: ' \203a'; }
Kind of expected really. But:
a:after { content: " #{'\203a'}"; }
Kind of a mess, but it outputs what I want:
a:after { content: " ›"; }
But I really want to be able to use non-ANSI characters straight in my scss files. It makes things much more readable. So this looks like a double-encoding bug that needs fixing, or the @charset
directive in need of fixing.
I’m using Sass version 3.4.13, Gem system 2.4.6, Ruby 2.1.3p242 x64, Windows 7 x64.
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
UTF-8 Encoding not working - Stack Overflow
Hi it's fixed there was problem in my file it was not encoded in "UTF-8". I fixed by replacing "bel p" to "beløp"....
Read more >How to solve unicode encoding issues - Invivoo
Special characters in UTF-8 are be stored in hexadecimal from 2 to 4 bytes. It is encoded simply by respecting the UTF-8 character...
Read more >What is UTF-8 Encoding? A Guide for Non-Programmers
Unicode was the solution to this problem. Unicode assigns a unique “code point” to every character in every human language. UTF-8 is a...
Read more >How can I fix the UTF-8 error when bulk uploading users?
This error is created when the uploaded file is not in a UTF-8 format. UTF-8 is the dominant character encoding format on the...
Read more >UTF8 encoding issue : replace the character - SAS Support ...
Solved: Hello, We have issues dealing with ANSI to UTF8 encoding mishaps in our migration from SAS 9.2 to 9.4 . Indeed the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update: Wow, it has to be in double quotes or it won’t work! This is not in the documentation, and doesn’t make sense since neither Sass nor CSS generally care about single or double quotes.
Any idea why this is the case?
/edit Not only that, but the charset declaration has to start at the very first byte of the file. Not even a comment may precede it.
@nex3 that doesn’t help. Output for that one character is still
content: ' ÔÇ║';
instead ofcontent: ' ›';
.I’ve put
@charset 'utf-8';
in the file where the character is, made 5000% sure it’s actually saved as utf-8, and I’ve even put the@charset
declaration in every scss file. No juice.