Foundation-sites: Invalid US-ASCII character "\xE2"

Created on 8 Apr 2016  路  11Comments  路  Source: foundation/foundation-sites

Hi,

after using zurb foundation 5 for about a year I'm trying to implement version 6.2.0 now. When saving my sass files I get the following error-message (SublimeText 3 console):
Error: Invalid US-ASCII character "\xE2" on line 15 of /.../vendor/bower/foundation-sites/scss/typography/_base.scss from line 12 of /.../vendor/bower/foundation-sites/scss/typography/_typography.scss from line 16 of /.../vendor/bower/foundation-sites/scss/foundation.scss

I searched the net for about 6 hours now but I can't find a way to solve the problem. Some suggest to add this line on top of config.rb:
Encoding.default_external = "utf-8"
But I don't use compass, so I don't have that file on my mac..

An other solution would be to put @charset "UTF-8"; on top of each file but of course I don't want to edit the foundation files managed by bower.

I thought maybe my ruby installation is configured not to utf-8 encoding but running ruby -e 'p Encoding.default_external' I get:

#<Encoding:UTF-8>

I know that the problem is that the at least some of the foundation files have comment lines using "this longer dash" or Hyphen? I don't know the right expression for english is not my native language. But I guess you know what I mean - it's just a little bit wider that a "minus (-)" ;)

According to your issue guidelines:

How can we reproduce this bug?
hard to say because it might be a configuration issues though I have no idea what to do about that and as said I didn't have the same problem using foundation 5.

What did you expect to happen?
sass compiling the scss files like it should ..

What happened instead?
ok doesn't make sense to continue with that for this issue is not related to a specific css case/ foundation classes.

For any ideas what I could do about that I would be very thankfull!

Best regards

resolved scss

Most helpful comment

@colin-marshall
thanks for your hint! That post at least leaded me into the right direction!

In case someone else has the same problem:

I use the SASS Build Plugin for Sublime Text 3 for compiling .scss files. What helped me was tweaking the config file for the build process:

// file: SASS.sublime-build

Original:
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],

// Added encoding directive:
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache", "--default-encoding=UTF-8"],

Now the error message is gone =)

Thanks for taking the time to respond and helping me out!

All 11 comments

Have you tried putting @charset 'utf-8'; at the top of the main SCSS file you import everything with? There's no messing with the Foundation files that way. That is how it's done in the Foundation templates:
https://github.com/zurb/foundation-zurb-template/blob/master/src/assets/scss/app.scss#L1

@colin-marshall Yes I have that line
@charset "utf-8";
on top of every of my .scss files - having double quotes like the sass docs say. Changed to single quotes to test but that doesn't help.
Thanks for your input though!

@Luckyfella73 what are you using to compile the SCSS?

Possibly relevant: https://github.com/csswizardry/inuit.css/issues/270#issuecomment-56056606

@colin-marshall
thanks for your hint! That post at least leaded me into the right direction!

In case someone else has the same problem:

I use the SASS Build Plugin for Sublime Text 3 for compiling .scss files. What helped me was tweaking the config file for the build process:

// file: SASS.sublime-build

Original:
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],

// Added encoding directive:
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache", "--default-encoding=UTF-8"],

Now the error message is gone =)

Thanks for taking the time to respond and helping me out!

Never had this issue before, but we now start getting this issue too using Compass. We had to add @charset "UTF-8"; at top of typograpy/_base.scss and components/_accordion.scss and then it did work again. This isn't a solution though, because those files are installed using Bower on other environments.

Same here.

How come that this isn't resolved yet? 馃槢 Seems a basic charset issue of these files to me.

:D I just noticed the issue. In my case I was using an 1.9 version of Ruby and no charset set. So I have updated it and executed:

sudo gem update --system
sudo gem install compass

This issue is still not resolved. I cannot fix it with the @charset "UTF-8"; trick because I use a build system using Webjars and get a java.nio.charset.MalformedInputException.
I only have trouble with typography (since upgrading to 6.3.0) and accordion.

@zy4 Is it putting @charset "UTF-8"; at the top of each file that causes the java.nio.charset.MalformedInputException ?

I prepared a PR for this: https://github.com/zurb/foundation-sites/pull/9570. Should be fixed with it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coachie picture coachie  路  4Comments

ncoden picture ncoden  路  3Comments

BicanMarianValeriu picture BicanMarianValeriu  路  3Comments

KharamanV picture KharamanV  路  3Comments

chanwhab picture chanwhab  路  3Comments