Error: invalid byte sequence in UTF-8


#1

Hi There!

I am relatively new to Jekyll but I have been working on a website relatively smoothly until now.
I could create the pages I needed and got the site and made it live.
While working on some additions the other day, out of the blue it started to give an error:

Invalid byte sequence in UTF-8.

I have started to look around and saw several topics on the github page, but nothing that worked so far for me.
I reverted everything I had been doing between the last time it built successfully and this error, and I am not able to get back to a working version. I removed all the images that I had added, a font that I had added and the 3 different pages I was working on at the time (removed them from the working directory). Still the same error.

THis is what I get:

$ bundle exec jekyll serve --watch
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
            Source: /Users/clemetre/Documents/Work/DFDwebsite
       Destination: /Users/clemetre/Documents/Work/DFDwebsite/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
jekyll 3.4.5 | Error:  invalid byte sequence in UTF-8

$ bundle exec jekyll doctor
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
jekyll 3.4.5 | Error:  invalid byte sequence in UTF-8

I added the encoding utf-8 in the _config.yml and it didn’t solve anything.

I ran a new test site jekyll and this works fine.

Does anybody have any idea to help me troubleshoot this? Or have an advice on how to solve this?

Thanks a lot!
Christophe


#2

I forgot to mention that I am on MacOS10


#3

been a while since I had trouble with this, but back then I think had to resave all the files in my editor and make sure the editor was saving them as utf-8.


#4

Thanks so much for your response.
I am unsure why that would be the case as I was only working with VIM on my console not using an editor. But I am willing to try anything at that point.

Thanks!


#5

FWIW we fixed a few UTF-8 encoding related bugs in 3.6.2, does it get better if you update to latest Jekyll?


#6

Hmm, I can take a look at the file itself… Here is an empty Gist, feel free to update it with the content of your _config.yml copy/pasting it as is (so we can track down the offending character).


#7

Hi Pabloduo,

Thanks for the reply. I just pasted the _config.yml.
What really troubles me is that it started kind of out of nowhere… The config.yml was not touched.

Thanks a lot
Christophe


#8

I got the latest version 3.7, but still get the same error:

$ bundle exec jekyll serve --watch
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
            Source: /Users/clemetre/Documents/Work/DFDwebsite
       Destination: /Users/clemetre/Documents/Work/DFDwebsite/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
jekyll 3.7.0 | Error:  invalid byte sequence in UTF-8


$ bundle exec jekyll doctor
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
jekyll 3.7.0 | Error:  invalid byte sequence in UTF-8

#9

I don’t think it has to be the config file that has the problem, I think it could be any file…

Try running it with --verbose and maybe it will give you more specific info. Seems like there is another argument that gives you additional error detail but I can’t think of it at the moment.


#10

THanks a lot Ron,

Here is my output with the --verbose option:

$ bundle exec jekyll serve --watch --verbose
  Logging at level: debug
Configuration file: /Users/clemetre/Documents/Work/DFDwebsite/_config.yml
  Logging at level: debug
         Requiring: /Users/clemetre/Documents/Work/DFDwebsite/_plugins/generator_scss.rb
         Requiring: jekyll-sitemap
         Requiring: kramdown
            Source: /Users/clemetre/Documents/Work/DFDwebsite
       Destination: /Users/clemetre/Documents/Work/DFDwebsite/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       EntryFilter: excluded /LICENSE.txt
           Reading: _posts/2016-10-20-PNAS-Urban-Park-Soil.markdown
           Reading: _posts/2017-09-15-PNAS-Australia.markdown
           Reading: _posts/2017-11-29-We-re-back.markdown
           Reading: _posts/2017-12-06-Recruiting-Teachers.markdown
           Reading: _posts/2018-01-16-Wired-Magazine-Article.markdown
       EntryFilter: excluded /automation/images
       EntryFilter: excluded /automation/minifying
       EntryFilter: excluded /illustrator/bg.png
       EntryFilter: excluded /illustrator/bg_1.png
       EntryFilter: excluded /illustrator/bg_2.png
       EntryFilter: excluded /illustrator/BG_image-01.png
       EntryFilter: excluded /illustrator/BG_image.ai
       EntryFilter: excluded /illustrator/chosen-sprite.png
       EntryFilter: excluded /illustrator/[email protected]
       EntryFilter: excluded /illustrator/headerRU.gif
       EntryFilter: excluded /illustrator/out copy.png
       EntryFilter: excluded /illustrator/out.png
       EntryFilter: excluded /illustrator/Whats-this-about.ai
jekyll 3.7.0 | Error:  invalid byte sequence in UTF-8

#11

What does this plugin do? Have you tried deactivating all plugins to see if maybe one of them is the offender?


#12

Hi Cristophe,

No worries, it is always my greatest pleasure to help folks! :wink: Sorry, it is my fault I wasn’t clear from the beginning - could you either create a new Gist (on Github) or share your _config.yml as is (Dropbox, Git or upload here as an attachment to the thread)?

Apologies for that extra roundtrip.

On the same note, if you can share your entire Jekyll folder that’s even better - I can try to debug it in & out (that’s what I usually do) to help you pinpoint the issue and find a cure to it.


#13

you know I think I once had that error with sass cause it didn’t like a comment I had in one of the files.

Maybe try removing all the sass contents and see if you still get it.


#14

Hey all,

Thanks a lot for your help! I finally realized what happened. In the data files that I have to generate automatically the individual pages, I had geographic locations. When my colleagues passed on to me the updated version with new samples in the data file, I didn’t realize that she had written some of these locations with spanish characters (e.g .México, Tza Itzá, Yucatán…). I just realized this and changed all the “á” into “a” and “é” into “e”, and now all is back to normal! :slight_smile:

Thank you all again for all your valuable and appreciated input!

Christophe


#15

@clemetre, glad you figured it out at the end! :tada: