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.
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.
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.
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).
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.
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.
No worries, it is always my greatest pleasure to help folks! 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.
I am experiencing this same issue, for a Markdown file. If I convert it to HTML, the error does not appear. How could I understand specifically where the invalid sequence is?
I am having this issue with image files and jekyll 3.9.2 on macOS 11.6.7 (Big Sur). I saved the image file as a PNG, and when I typed bundle exec jekyll serve, I got this:
Error: could not read file /LocalHome/blog/blog.github.io/_posts/2022-07-18-postname/filename.png: invalid byte sequence in UTF-8
So I tried a different graphic editor: loaded the file and resaved it. Same error.
So I tried saving the file as a GIF and a JPG. I just saved the files to my drive; that’s all. I didn’t reference them anywhere. And when I typed bundle exec jekyll serve a second time, I got this:
Error: could not read file /LocalHome/blog/blog.github.io/_posts/2022-07-18-postname/filename.gif: invalid byte sequence in UTF-8
Error: could not read file /LocalHome/blog/blog.github.io/_posts/2022-07-18-postname/filename.jpg: invalid byte sequence in UTF-8
Error: could not read file /LocalHome/blog/blog.github.io/_posts/2022-07-18-postname/filename.png: invalid byte sequence in UTF-8
What’s interesting is that the same image file stored in the directory /LocalHome/blog/blog.github.io/_posts/images/filename.png throws no error.
I don’t think putting images in the _posts folder is supported very well. If you put the image in assets/images or something like that you have no issues?
Maybe the invalid sequence is cause it is looking for a text file of some sort and getting an image file.
I think there are some other threads in here about people wanting to have the images in with the post and different ways to do that.