I'm trying to run jekyll build
on GitLab CI.
This is my .gitlab-ci.yml
:
pages:
script:
- export LC_ALL=en_US.UTF-8
- export LANG=en_US.UTF-8
- gem install jekyll
- jekyll build --destination public
artifacts:
paths:
- public
When the task runs I get this error:
Generating...
Liquid Exception: invalid byte sequence in US-ASCII in documentation.html
jekyll 3.1.2 | Error: invalid byte sequence in US-ASCII
ERROR: Build failed with: exit code 1
documentation.html
is:
---
layout: page
title: Documentation
description: Learn how to create awesome poppers
---
<!-- This page is generated by the grunt doc task of the master branch! Don't edit it! -->
{% markdown documentation.md %}
And documentation.md
is a markdown document generated by grunt-jsdoc2md
.
This is the markdown
plugin I'm using:
=begin
Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
Usage:
{% markdown <filename> %}
Dependency:
- kramdown
=end
module Jekyll
class MarkdownTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
require "kramdown"
def render(context)
tmpl = File.read File.join Dir.pwd, "_includes", @text
site = context.registers[:site]
tmpl = (Liquid::Template.parse tmpl).render site.site_payload
html = Kramdown::Document.new(tmpl).to_html
end
end
end
Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag)
As you see, I've already tried setting LC_ALL
and LANG
to en_US.UTF-8
.
I've also added encoding: utf-8
to my _config.yml
but it still doesn't work...
Another attempt was to use @text = text.encode("iso-8859-1").force_encoding("utf-8").strip
in the markdown plugin.
Suggestions?
I had the same problem and found this solution, which worked for me. https://gitlab.com/gitlab-org/gitlab-ce/issues/14983
image: ruby:2.3
before_script:
- apt-get update >/dev/null
- apt-get install -y locales >/dev/null
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US:en
- export LC_ALL=en_US.UTF-8
I deleted the markdown plugin and used this:
---
layout: page
title: Documentation
description: Learn how to create awesome poppers
---
<!-- This page is generated by the grunt doc task of the master branch! Don't edit it! -->
{% capture documentation %}
{% include documentation.md %}
{% endcapture %}
{{ documentation | markdownify }}
Everything seems working fine now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With