0

I'm using grunt, grunt-contrib-sass, and angular material. After adding in angular material, the build began failing in the CI process (BitBucket Pipelines). The error is:

Invalid US-ASCII character "\xE2" online 4242 of bower_components/angular-material/angular-material.scss

Everything I've read about solving this involves setting the encoding at the top of the SASS file, but since it's installed via bower during the build process, that's not plausible. I did try adding this to the top of my main scss file where angular material is imported, but this did not work.

I'm using a PC and it works fine locally. I'm using a docker image starefossen/ruby-node:latest for CI which is where it fails. Here's the build script in pipelines:

npm install npm install -g bower bower install --allow-root npm install -g grunt-cli gem install sass grunt test grunt build

This installs sass 3.4.22.

Lefka
  • 633
  • 6
  • 20

3 Answers3

2

Are you using a Mac? What version of Sass are you using?

Also found this, might help:

Just add this line to top of config.rb
Encoding.default_external = "utf-8"
rrd
  • 5,789
  • 3
  • 28
  • 36
  • Perhaps I'm wrong but from what I can tell, config.rb is specific to compass. I answered the rest of your questions in an edit above. – Lefka Apr 26 '17 at 14:33
  • Like @rrd said...I ran into the same charset problem. Especially on OSX there seams to be a problem with ruby Encoding Settings. I fixed it creating a config.rb file in the main project directory to tell ruby explicitly which charset encoding it should use. Since sass and compass depend on ruby, chances good that this will fix your problems. Encoding.default_external = 'utf-8' – mrmoree Apr 08 '20 at 12:29
  • Where can we find 'config.rb' or Where should we create 'config.rb'? – arjunbnair Nov 19 '21 at 11:16
0

Changing file encoding in one way or another could prob work.

You could also check your material.scss (On line 4242 it looks like) or the code you added and replace suspicious characters..

\xe2 is normally a character like , or - but not the same as the ascii entered by keyboard. often these enters your code if you copy-paste from the web.

in your newly added code replace non-letter characters with ones typed by keyboard and it should work.

JohanSellberg
  • 2,423
  • 1
  • 21
  • 28
  • 1
    I can't edit the code. The code is in a library that isn't imported until a build is started. Changing the file encoding is fine with me, but I don't know how to accomplish this without editing the library (which I can't do). – Lefka Apr 26 '17 at 14:33
0

As rrd wrote:

Are you using a Mac? What version of Sass are you using?

Also found this, might help:

Just add this line to top of config.rb Encoding.default_external = "utf-8"

I ran into the same charset problem.

Especially on OSX there seams to be a problem with ruby Encoding Settings.

I fixed it creating a config.rb file in the main project directory to tell ruby explicitly which charset encoding it should use. Since sass and compass depend on ruby, chances good that this will fix your problems.

Encoding.default_external = 'utf-8'
Community
  • 1
  • 1
mrmoree
  • 412
  • 4
  • 10
  • Could you please explain deep where exactly you added the 'config.rb' file? From where you ran SASS or where SASS is installed? @mrmoree – arjunbnair Nov 19 '21 at 08:25
  • 1
    @arjunbnair As i wrote i added the config.rb file in the project root directory. Can'T quiet remember from where i ran ruby but try running it from project root. As the rails documentation (https://guides.rubyonrails.org/configuring.html#config-encoding) states, charset defaults to utf-8. – mrmoree Jan 24 '22 at 15:17