don't set default Encodings in ruby 1.9

closes #CNVS-2165

This is recommended in some guides for upgrading a Rails 2.3 app to Ruby
1.9, but it was causing a lot of problems with file reading and writing,
especially in gems.

Our override for ActiveSupport::SafeBuffer to always be encoded as utf-8
fixes the issue that originally prompted us to add these default
encodings in the first place.

Change-Id: Ifb4649dd6aa86bfb15ff16daa706a5c6df33292a
Reviewed-on: https://gerrit.instructure.com/16079
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2012-12-13 16:04:54 -07:00
parent a7c03cc85a
commit 103b8d1bfc
2 changed files with 1 additions and 2 deletions

View File

@ -132,7 +132,7 @@ else
# (which in canvas is utf-8)
class ActiveSupport::SafeBuffer
def initialize(*a)
super.force_encoding(Encoding.default_internal)
super.force_encoding('utf-8')
end
end
end

View File

@ -14,7 +14,6 @@ begin
# Set up load paths for all bundled gems
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
Encoding.default_internal = Encoding.default_external = 'UTF-8' if defined?(Encoding)
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"