aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-08 00:18:09 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-08 00:18:09 -0800
commitf84bf83b9b5b0f0ff692729873d3de835d7de377 (patch)
tree8f9491f4c5fa5bc2696e0bb6a2d74f6586c6f63c
parent0144f4f023348e64e0816e41b4f9dd2ad819e443 (diff)
parent199353c658007727a428949ac11663175fb2c531 (diff)
downloadrails-f84bf83b9b5b0f0ff692729873d3de835d7de377.tar.gz
rails-f84bf83b9b5b0f0ff692729873d3de835d7de377.tar.bz2
rails-f84bf83b9b5b0f0ff692729873d3de835d7de377.zip
Merge pull request #3888 from kennyj/should_use_default_charset
Assign config.encoding to AD::Response.default_charset at the initialization time.
-rw-r--r--actionpack/lib/action_dispatch/railtie.rb1
-rw-r--r--railties/test/application/initializers/frameworks_test.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb
index 2ba3198ebd..a4f4825f92 100644
--- a/actionpack/lib/action_dispatch/railtie.rb
+++ b/actionpack/lib/action_dispatch/railtie.rb
@@ -21,6 +21,7 @@ module ActionDispatch
initializer "action_dispatch.configure" do |app|
ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length
ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header
+ ActionDispatch::Response.default_charset = app.config.encoding
ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb
index 446c85d65a..e6e2c525f5 100644
--- a/railties/test/application/initializers/frameworks_test.rb
+++ b/railties/test/application/initializers/frameworks_test.rb
@@ -136,6 +136,12 @@ module ApplicationTests
assert_equal 2, ActionDispatch::Http::URL.tld_length
end
+ test "assignment config.encoding to default_charset" do
+ add_to_config "config.encoding = 'Shift_JIS'"
+ require "#{app_path}/config/environment"
+ assert_equal 'Shift_JIS', ActionDispatch::Response.default_charset
+ end
+
# AS
test "if there's no config.active_support.bare, all of ActiveSupport is required" do
use_frameworks []