Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

unicode variables are formatted to UTF-8 during compilation #1331

Closed
nicolaspanel opened this issue Jan 5, 2016 · 3 comments
Closed

unicode variables are formatted to UTF-8 during compilation #1331

nicolaspanel opened this issue Jan 5, 2016 · 3 comments

Comments

@nicolaspanel
Copy link

Issue: unicode variables are formatted to UTF-8 during compilation
Example: fa-glass icon from font-awesome
It is defined as :

.#{$fa-css-prefix}-glass:before { content: $fa-var-glass; } // see https://github.com/FortAwesome/Font-Awesome/blob/master/scss/_icons.scss#L4) 
//  with 
$fa-var-glass: "\f000"; // see https://github.com/FortAwesome/Font-Awesome/blob/master/scss/_variables.scss#L304

// After compilation it becomes:

.fa-glass:before{content:""} 
// instead of
.fa-glass:before{content:"\f000"}

SSCCE:

> var sass = require('node-sass');
> console.log(sass.renderSync({data: '$fa-var-glass: "\\f000"; .fa-glass:before { content: $fa-var-glass; }'}).css.toString())
@charset "UTF-8";
.fa-glass:before {
  content: ""; }

Versions:

  • node: v4.2.4
  • node-sass: v3.4.2
  • font-awesome: v4.5.0
@nicolaspanel nicolaspanel changed the title unicode varibles are formated to UTF-8 during compilation unicode variables are formated to UTF-8 during compilation Jan 5, 2016
@nicolaspanel nicolaspanel changed the title unicode variables are formated to UTF-8 during compilation unicode variables are formatted to UTF-8 during compilation Jan 5, 2016
@xzyfer
Copy link
Contributor

xzyfer commented Jan 12, 2016

Please do not post code that does not compile. We will not dig through your framework to figure what's going.

I'll assume you meant the following.

$fa-var-glass: "\f000";
foo {
  content: $fa-var-glass;

In which case both node-sass and Ruby Sass output

@charset "UTF-8";
.glass:before {
  content: "";
}

It might not look pretty but it's perfectly valid CSS. Since we're doing what Ruby Sass does this is not a bug.

@nicolaspanel
Copy link
Author

Thank you for the answer but the generated CSS should be :

.glass:before {
  content: "\f000"; // not ""
}

Seems to be a libsass bug then...

@xzyfer
Copy link
Contributor

xzyfer commented Jan 12, 2016

@nicolaspanel this is not a bug. It's on purpose. The value is being converted to the utf value and @charset "UTF-8"; is being added. This is what Ruby Sass does, so it's what LibSass must do.

Friendly-users referenced this issue in Friendly-users/node-sass Jul 9, 2024
-----
It is inappropriate to include political and offensive content in public code repositories.

Public code repositories should be neutral spaces for collaboration and community, free from personal or political views that could alienate or discriminate against others. Political content, especially that which targets or disparages minority groups, can be harmful and divisive. It can make people feel unwelcome and unsafe, and it can create a hostile work environment.

Please refrain from adding such content to public code repositories.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants