Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concatenation/interpolation results in unrecognised character #2320

Closed
nickdunn opened this issue Feb 6, 2017 · 8 comments
Closed

Concatenation/interpolation results in unrecognised character #2320

nickdunn opened this issue Feb 6, 2017 · 8 comments

Comments

@nickdunn
Copy link

nickdunn commented Feb 6, 2017

When concatenating two characters together, some combinations result in unrecognised characters being output.

The following test case is a real-world case where I want to append a non-breaking space (\feff) to another character that is used in an icon font.

$char-f: '\66';
$char-g: '\67';

.test-1 {
  content: '#{$char-f}\feff';
}

.test-2 {
  content: '#{$char-g}\feff';
}

// this is broken
.test-3 {
  content: '\feff#{$char-f}';
}

.test-4 {
  content: '\feff#{$char-g}';
}

Output:

@charset "UTF-8";
.test-1 {
  content: "f";
}

.test-2 {
  content: "g";
}

.test-3 {
  content: "󾿿";
}

.test-4 {
  content: "g";
}

(Note that \feff is present in 3 of the 4 examples, but it's invisible).

When \feff is concatenated with \66 a single unrecognised character is returned rather than two.

I've been able to replicate this with the latest https://github.com/sass/node-sass wrapper, as well as pasting the above into http://sass.js.org.

@nickdunn
Copy link
Author

nickdunn commented Feb 13, 2017

Input:

$char: '\66';
content: '\feff#{$char}';

Output (fail):

content: "󾿿";

However if I put a space between them, I get the correct output.

Input:

content: '\feff #{$char-f}';

Output (pass):

content: "f";

Weird that the space gets collapsed?

@nickdunn nickdunn changed the title Concatenation results in unrecognised character Concatenation/interpolation results in unrecognised character Feb 13, 2017
@nickdunn
Copy link
Author

May be related to #1115.

@xzyfer
Copy link
Contributor

xzyfer commented Mar 21, 2017

Spec added sass/sass-spec#1094

@mgreter
Copy link
Contributor

mgreter commented May 21, 2017

The space "gets eaten" as described in the css specs:
https://www.w3.org/TR/css-syntax-3/#consume-an-escaped-code-point

Consume as many hex digits as possible, but no more than 5. Note that this means 1-6 hex digits have been consumed in total. If the next input code point is whitespace, consume it as well. Interpret the hex digits as a hexadecimal number. If this number is zero, or is for a surrogate code point, or is greater than the maximum allowed code point, return U+FFFD REPLACEMENT CHARACTER (�). Otherwise, return the code point with that value.

@nickdunn
Copy link
Author

I am still able to recreate this issue using libsass 3.5.0.beta.2 (via node-sass 4.5.3)

@nickdunn
Copy link
Author

Could this issue be re-opened?

@mgreter
Copy link
Contributor

mgreter commented Sep 27, 2017

This is fixed on latest master (or in 3.4.5) after 3.5.0.beta.2 was tagged!

@nickdunn
Copy link
Author

Ah, please accept my apologies — I was following the wrong tag. Do you know when this might make it into a release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants