Skip to content
This repository
Browse code

Merge pull request #375 from k33l0r/master.

Google Chrome sometimes incorrectly identifies the rescues template charset
  • Loading branch information...
commit 7ae3b82ceb83827a6f1c22ee6a6dbcfa0c44d13b 2 parents 1ca8123 + 49b825e
José Valim josevalim authored
2  actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -116,7 +116,7 @@ def status_code(exception)
116 116 end
117 117
118 118 def render(status, body)
119   - [status, {'Content-Type' => 'text/html', 'Content-Length' => body.bytesize.to_s}, [body]]
  119 + [status, {'Content-Type' => "text/html; charset=#{Response.default_charset}", 'Content-Length' => body.bytesize.to_s}, [body]]
120 120 end
121 121
122 122 def public_path
6 actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
... ... @@ -1,11 +1,13 @@
1   -<html xmlns="http://www.w3.org/1999/xhtml">
  1 +<!DOCTYPE html>
  2 +<html lang="en">
2 3 <head>
  4 + <meta charset="utf-8" />
3 5 <title>Action Controller: Exception caught</title>
4 6 <style>
5 7 body { background-color: #fff; color: #333; }
6 8
7 9 body, p, ol, ul, td {
8   - font-family: verdana, arial, helvetica, sans-serif;
  10 + font-family: helvetica, verdana, arial, sans-serif;
9 11 font-size: 13px;
10 12 line-height: 18px;
11 13 }
7 actionpack/test/dispatch/show_exceptions_test.rb
@@ -137,4 +137,11 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest
137 137 assert_response 500
138 138 assert_match(/RuntimeError\n in FeaturedTilesController/, body)
139 139 end
  140 +
  141 + test "sets the HTTP charset parameter" do
  142 + @app = DevelopmentApp
  143 +
  144 + get "/", {}, {'action_dispatch.show_exceptions' => true}
  145 + assert_equal "text/html; charset=utf-8", response.headers["Content-Type"]
  146 + end
140 147 end

0 comments on commit 7ae3b82

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