Error: invalid byte sequence in US-ASCII

Theme Builder / Splash Page Project 

Sheena Jain
All about an intern at OPW
2 min readJun 16, 2014

--

It was indeed a tough week for me trying to fix an error that said : “jekyll 2.0.0 | Error: invalid byte sequence in US-ASCII”. I must have checked almost all the fixes available online which were even remotely related to the error (jekyll/issues/#226, #201, #498, #188, #960, #836, #1882, #1205, #2117, ….…).

This happened when I was trying to reproduce the commotionwireless.net website available here : https://github.com/opentechinstitute/commotion-docs following the steps given below :

Step1 : Open the terminal

Step2 : Run git clone https://github.com/opentechinstitute/commotion-docs.git

Step3 : Enter into the commotionwireless.net directory

Step4 : Run sudo jekyll serve

Now as soon you write in the prompt you get an error:

Configuration file: /home/commotion-docs/commotionwireless.net/_config.yml

Source: /home/commotion-docs/commotionwireless.net

Destination: /home/commotion-docs/commotionwireless.net/_site

Generating…

jekyll 2.0.0 | Error: invalid byte sequence in US-ASCII.

How did I fix the error ?

Method 1:

So, try and check if encoding has utf-8 format.

Type echo $LANG, if not then simply declare the following in your shell :

export LC_ALL=en_US.UTF-8

export LANG=en_US.UTF-8.

Try now!

If it still does not work then switch to the final resort :

Method 2:

Step1 : Go to this location : /var/lib/gems/1.9.1/gems/jekyll-2.0.0/lib

Step2 : Open jekyll.rb

Step3 : Go to def.sanitized_path() function in jekyll.rb to force the proper encoding:

edit and write this clean_path.force_encoding(‘UTF-8').gsub!(/\A\w\:\//, ‘/’) {likely line no 121}

Take a deep breath, cross your fingers ;)

Try now! ☺

It did the trick for me so most likely it will work for you too.

Updates about my progress on the plug-in will be posted soon ! Stay connected ☺

--

--