Skip to content

Commit a3a12ba

Browse files
committed
Fix default encoding in config.ru
Ruby 1.9 cares about encoding, and apache starts up as US-ASCII in most cases. If you have a manifest that is UTF-8, then puppet won't be able to handle it. To work around that, we change the default encoding. See https://tickets.puppetlabs.com/browse/PUP-1386 and puppetlabs/puppet#1666 for more details.
1 parent 6e480fd commit a3a12ba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

templates/config.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# a config.ru, for use with every rack-compatible webserver.
22
# SSL needs to be handled outside this, though.
33

4+
# Ruby 1.9 cares about encoding, and apache starts up as US-ASCII in most
5+
# cases. If you have a manifest that is UTF-8, then puppet won't be able to
6+
# handle it. To work around that, we change the default encoding. See
7+
# https://tickets.puppetlabs.com/browse/PUP-1386 and
8+
# https://github.com/puppetlabs/puppet/pull/1666 for more details.
9+
if RUBY_VERSION >= "1.9"
10+
Encoding.default_external = Encoding::UTF_8
11+
Encoding.default_internal = Encoding::UTF_8
12+
end
13+
414
# if puppet is not in your RUBYLIB:
515
# $LOAD_PATH.unshift('/opt/puppet/lib')
616

0 commit comments

Comments
 (0)