Explicitly set encoding for Precious::App (#1731)
An issue was reported (see #1721) where, in docker containers where the `LANG` was not being set, `Precious::App` would serve Mustache templates in an ASCII encoding. This caused templates to error out. In the past, this would have happened in environments where `LANG` was not set and the Gollum applciation configuration had enabled MathJax. Now, it happens even if MathJax is disabled because of a UTF-8 character I added to the mobile navigation menu. Basically, we should enforce a UTF-8 encoding from now on to avoid runtime errors related to ASCII encoding.
This commit is contained in:
+4
-1
@@ -1,4 +1,5 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
# encoding: UTF-8
|
||||
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'sinatra/namespace'
|
||||
@@ -69,6 +70,8 @@ module Precious
|
||||
register Sinatra::Namespace
|
||||
include Precious::Helpers
|
||||
|
||||
Encoding.default_external = "UTF-8"
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
set :sprockets, ::Precious::Assets.sprockets(dir)
|
||||
|
||||
Reference in New Issue
Block a user