johno / pixyll

A simple, beautiful Jekyll theme that's mobile first
http://pixyll.com
MIT License
2.05k stars 1.34k forks source link

"Invalid US-ASCII character" generating css #193

Closed bennettrogers closed 9 years ago

bennettrogers commented 9 years ago

This is a beautiful theme.

I just tried to clone pixyll and serve the master branch, and (after commenting out the gems as in #121) I'm getting:

Conversion error: Jekyll::Converters::Scss encountered an error while converting 'css/pixyll.scss':
    Invalid US-ASCII character "\xC2" on line 7
jekyll 2.5.3 | Error:  Invalid US-ASCII character "\xC2" on line 7

Ruby version is 2.2.2p95, and Jekyll version is 2.5.3.

Thanks!

johno commented 9 years ago

Hm, that's weird. I've run into this before with Jekyll, but it was the result of a CSS file not having declared @charset "UTF-8";. I just double checked to make sure the Pixyll CSS file did, and noticed that it was declared as "utf-8" rather than "UTF-8" that the Mozilla docs specify, so I'm wondering if that has anything to do with it.

I'm going to push a change for the charset casing so you can give that a try.

johno commented 9 years ago

You can now pull down the latest changes, @bennettrogers. Please let me know if this works or not, thanks!

bennettrogers commented 9 years ago

It wasn't the casing issue (that would have been sad if it was).

The issue is that in my bash profile, I have the LC_ALL="C". I had done this to get file sorting via ls to behave in a preferred way, but it's apparently forcing other aspects of my system to use ascii instead of UTF-8. I'm not familiar with the differences in locale settings, but this stackexchange answer does a decent job of explaining.

It seems like this might be an issue within jekyll or ruby, but I couldn't figure out a fix to allow the site to build under that locale.

My solution is to change my locale to be "C.UTF-8", which apparently has most of the qualities of the C locale, while enabling UTF-8 support. I didn't even know this locale existed, and I guess it doesn't exist everywhere - for example Ubuntu 10.04 and OSX don't have it.

Now my bash profile contains:

if locale -a | grep -qF 'C.UTF-8'; then
    loc="C.UTF-8"
else
    loc="en_US.UTF-8"
fi
export LANG=$loc
export LC_ALL=$loc

This seems to work for now (until I find a reason why I really do want the C locale and use it when C.UTF-8 isn't available).

Thanks for looking into this so quickly!

johno commented 9 years ago

No worries, I'm glad you were able to come up with a solution. Thanks for creating such a detailed response in case someone else encounters the same issue.

joonas-fi commented 9 years ago

Much appreciated @bennettrogers, I had the same issue while running Jekyll in a Docker container (ubuntu:latest image).

The locale was set to "POSIX", and changing it to "C.UTF-8" did the trick.

Solution was to add this to my Dockerfile:

ENV LC_ALL C.UTF-8

Hat tip: http://askubuntu.com/questions/581458/how-to-configure-locales-to-unicode-in-a-docker-ubuntu-14-04-container

maratgaliev commented 9 years ago

Same thing:

DEBUG [6daaba0d]      Conversion error: Jekyll::Converters::Scss encountered an error while converting 'css/pixyll.scss':
DEBUG [6daaba0d]                        Invalid US-ASCII character "\xC2" on line 7
DEBUG [6daaba0d]    jekyll 2.5.3 | Error:  Invalid US-ASCII character "\xC2" on line 7