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

Mark this CSS file as containing unicode #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PeterJCLaw
Copy link
Member

The root file already has this marker, so you'd hope that this wouldn't be needed, however we have seen build failures where developers don't have a suitable locale set, which this aims to avoid.

Note: this is a speculative change pending testing.

The root file already has this marker, so you'd hope that this
wouldn't be needed, however we have seen build failures where
developers don't have a suitable locale set, which this aims to
avoid.
@PeterJCLaw PeterJCLaw requested a review from raccube July 24, 2021 08:26
@raccube
Copy link
Member

raccube commented Jul 25, 2021

Just tried this and I get the same result as before.

Output
/bin/zsh -c "bash -c 'env RBENV_VERSION=2.6.3 /usr/local/Cellar/rbenv/1.1.2/libexec/rbenv exec ruby /Users/mh/Projects/srobo-competition-website/gems/ruby/2.6.0/bin/rake dev'"
bundle install --path gems
Using rake 12.3.3
Using public_suffix 4.0.6
Using addressable 2.8.0
Using bundler 1.17.3
Using colorator 1.1.0
Using concurrent-ruby 1.1.8
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.2
Using ffi 1.15.0
Using forwardable-extended 2.6.0
Using i18n 0.9.5
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using sass-listen 4.0.0
Using sass 3.7.4
Using jekyll-sass-converter 1.5.2
Using listen 3.5.1
Using jekyll-watch 2.2.1
Using rexml 3.2.5
Using kramdown 2.3.1
Using liquid 4.0.3
Using mercenary 0.3.6
Using pathutil 0.16.2
Using rouge 3.26.0
Using safe_yaml 1.0.5
Using jekyll 3.9.0
Bundle complete! 3 Gemfile dependencies, 27 gems now installed.
Bundled gems are installed into `./gems`
bundle exec jekyll serve --drafts --config _config.yml,_local.yml
Configuration file: _config.yml
Configuration file: _local.yml
            Source: /Users/mh/Projects/srobo-competition-website
       Destination: /Users/mh/Projects/srobo-competition-website/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'css/main.scss':
                    Invalid US-ASCII character "\xE2" on line 77
rake aborted!
Command failed with status (1): [bundle exec jekyll serve --drafts --config...]
/Users/mh/Projects/srobo-competition-website/Rakefile:18:in `block in <top (required)>'
Tasks: TOP => dev
(See full trace by running task with --trace)
jekyll 3.9.0 | Error:  Invalid US-ASCII character "\xE2" on line 77

Process finished with exit code 1
Locale settings
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
image

@raccube
Copy link
Member

raccube commented Jul 25, 2021

So it turns out this is an issue specific to my setup. Upon changing the Region setting to United Kingdom, my locale changed to en_GB.UTF-8. It was previously falling back to C as en_AT.UTF-8 doesn't exist. Same thing for German (de_AT)

@PeterJCLaw
Copy link
Member Author

This is very odd. It looks like this is essentially jekyll/jekyll#4268.
The characters in question that are causing this are in _sass/comp/common.scss

I can get this to fail if I forcibly remove LANG from my environment (by running LANG= rake dev on master), however I get a different stack trace than you (it has the right file mentioned, rather than misattributing _sass/main.scss; the line number is already correct). In that scenario the issue goes away when running this branch, presumably because of the charset marker.

@raccube could you try the suggestion around the config setting mentioned in jekyll/jekyll#4268 (comment) and report back? I suspect it won't work here given that it didn't work there.

The other option would be to use escape sequences, though I'd really still want to have the actual characters in place for easier reading and I suspect that comments may also fall afoul of this issue. That might be worth testing too though.

@raccube
Copy link
Member

raccube commented Jul 25, 2021

Setting encoding: utf-8 didn't seem to do anything. It's worth noting that removing the first two lines from _sass/main.scss does get rid of the error but doesn't output any CSS.

@PeterJCLaw
Copy link
Member Author

removing the first two lines from _sass/main.scss does get rid of the error but doesn't output any CSS.

Yeah, this is because those first two lines are what tell Jekyll that these sass files should be processed. It's unsurprising that if they're removed that the error doesn't happen, since the whole of the sass parsing isnt' happening.

@PeterJCLaw
Copy link
Member Author

The other thing which might be interesting to try would be to add a unicode BOM to the file. Again I'm not sure I like that nor am I convinced that it's going to work if your locale actually doesn't have a unicode codec available (though that being the case is just ludicrous these days).

@raccube
Copy link
Member

raccube commented Jul 25, 2021

There is a UTF-8 version of the default locale (C.UTF-8) but I don't think it will ever end up being default.

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

Successfully merging this pull request may close these issues.

2 participants