diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-03 06:44:01 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-03 06:44:01 -0700 |
commit | 7ae3b82ceb83827a6f1c22ee6a6dbcfa0c44d13b (patch) | |
tree | b26a52e2e31bab2314a42b6f03ea53d98d71e780 | |
parent | 1ca81238b5abcbdad667d45a588fdb1f68a0516e (diff) | |
parent | 49b825e502d57f10aa2cee10c1d631a95f3cef64 (diff) | |
download | rails-7ae3b82ceb83827a6f1c22ee6a6dbcfa0c44d13b.tar.gz rails-7ae3b82ceb83827a6f1c22ee6a6dbcfa0c44d13b.tar.bz2 rails-7ae3b82ceb83827a6f1c22ee6a6dbcfa0c44d13b.zip |
Merge pull request #375 from k33l0r/master.
Google Chrome sometimes incorrectly identifies the rescues template charset
3 files changed, 12 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb index b1adf3d2d1..c17c746096 100644 --- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb @@ -116,7 +116,7 @@ module ActionDispatch end def render(status, body) - [status, {'Content-Type' => 'text/html', 'Content-Length' => body.bytesize.to_s}, [body]] + [status, {'Content-Type' => "text/html; charset=#{Response.default_charset}", 'Content-Length' => body.bytesize.to_s}, [body]] end def public_path diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb index 6c32fb17b8..6e71fd7ddc 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb @@ -1,11 +1,13 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> +<!DOCTYPE html> +<html lang="en"> <head> + <meta charset="utf-8" /> <title>Action Controller: Exception caught</title> <style> body { background-color: #fff; color: #333; } body, p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; + font-family: helvetica, verdana, arial, sans-serif; font-size: 13px; line-height: 18px; } diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index e453dd11ce..cc57a6cba0 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -137,4 +137,11 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest assert_response 500 assert_match(/RuntimeError\n in FeaturedTilesController/, body) end + + test "sets the HTTP charset parameter" do + @app = DevelopmentApp + + get "/", {}, {'action_dispatch.show_exceptions' => true} + assert_equal "text/html; charset=utf-8", response.headers["Content-Type"] + end end |