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

Abort thrown with smart quote #2016

Closed
xzyfer opened this issue Apr 21, 2016 · 3 comments
Closed

Abort thrown with smart quote #2016

xzyfer opened this issue Apr 21, 2016 · 3 comments

Comments

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

$_: ___((Classes and IDs must follow a specific grammar. And this thing here doesn’t.));

Ruby Sass

Error: Invalid CSS after "...pecific grammar": expected ")", was ". And this thin..."
        on line 1 of test.scss
  Use --trace for backtrace.

LibSass 3.3.5

Assertion failed: (utf8_validate(str)), function emit_string, file src/json.cpp, line 1144.
[1]    51273 abort      ~/Projects/Sass/sassc/bin/sassc test.scss

Spec added sass/sass-spec#776

@mgreter
Copy link
Contributor

mgreter commented Apr 21, 2016

This works correct for me if I save the input as valid utf8.
I only see this if I save it with wrong encoding, so what should be done here?

@xzyfer
Copy link
Contributor Author

xzyfer commented Apr 21, 2016

I'm not sure to be honest. IIRC Ruby Sass has some logic around file encodings i.e. if it encounters a unicode character it inserts @charset "utf-8"; automatically.

I wonder if it assumes all files are utf-8 by default... @chriseppstein may have some insight.

@mgreter
Copy link
Contributor

mgreter commented Apr 21, 2016

The error happens because the byte sequence is found to NOT be valid utf8. So what should we do? This can happen because of invalid input but also if we do a substring not accounting for utf8 sequence (meaning there is a chance a multibyte utf8 character gets "split in half"). We cannot do much about the first and I only would count the later as a bug (fixed a few of them already, as with i.e. with error reporting).

Edit: looks like we should just print Internal Error: Invalid UTF-8 but not segfault. This is the case if you create a file with the following content \xB4 (´ encoded in latin1).

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

2 participants