Fix error invalid byte sequence without en_US.UTF-8 locale

Because Ruby does not set `Encoding.default_external` with
non-existent locale such as `en_US.UTF-8`. Original code expects that
`en_US.UTF-8` is available locale implicitly. However, it shouldn't be
assumed.

In this case, we can use `-Eutf-8:utf-8` to specify external encoding
and internal encoding.
This commit is contained in:
Kenji Okimoto 2018-02-04 22:37:17 +09:00
parent 5d1999547d
commit efc82d6fbf
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ namespace :guides do
desc "Generate HTML guides"
task html: :encoding do
ENV["WARNINGS"] = "1" # authors can't disable this
ruby "rails_guides.rb"
ruby "-Eutf-8:utf-8", "rails_guides.rb"
end
desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/gp/feature.html?docId=1000765211"