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.

UTF-8 encoding not working

See original GitHub issue

An 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:closed
  • Created 9 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
thanycommented, Jul 10, 2015

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.

2reactions
thanycommented, Jul 10, 2015

@nex3 that doesn’t help. Output for that one character is still content: ' ÔÇ║'; instead of content: ' ›';.

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.

Read more comments on GitHub >

github_iconTop 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 >

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