Browse files

Merge pull request #3888 from kennyj/should_use_default_charset

Assign config.encoding to AD::Response.default_charset at the initialization time.
  • Loading branch information...
2 parents 0144f4f + 199353c commit f84bf83b9b5b0f0ff692729873d3de835d7de377 @josevalim josevalim committed Dec 8, 2011
View
1 actionpack/lib/action_dispatch/railtie.rb
@@ -21,6 +21,7 @@ class Railtie < Rails::Railtie
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)
View
6 railties/test/application/initializers/frameworks_test.rb
@@ -136,6 +136,12 @@ def from_bar_helper
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 []

0 comments on commit f84bf83

Please sign in to comment.