Skip to content
This repository
Browse code

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...
commit f84bf83b9b5b0f0ff692729873d3de835d7de377 2 parents 0144f4f + 199353c
José Valim josevalim authored
1  actionpack/lib/action_dispatch/railtie.rb
@@ -21,6 +21,7 @@ class Railtie < Rails::Railtie
21 21 initializer "action_dispatch.configure" do |app|
22 22 ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length
23 23 ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header
  24 + ActionDispatch::Response.default_charset = app.config.encoding
24 25
25 26 ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
26 27 ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)
6 railties/test/application/initializers/frameworks_test.rb
@@ -136,6 +136,12 @@ def from_bar_helper
136 136 assert_equal 2, ActionDispatch::Http::URL.tld_length
137 137 end
138 138
  139 + test "assignment config.encoding to default_charset" do
  140 + add_to_config "config.encoding = 'Shift_JIS'"
  141 + require "#{app_path}/config/environment"
  142 + assert_equal 'Shift_JIS', ActionDispatch::Response.default_charset
  143 + end
  144 +
139 145 # AS
140 146 test "if there's no config.active_support.bare, all of ActiveSupport is required" do
141 147 use_frameworks []

0 comments on commit f84bf83

Please sign in to comment.
Something went wrong with that request. Please try again.