Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
View
@@ -116,7 +116,7 @@ def status_code(exception)
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
6 actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
View
@@ -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;
}
7 actionpack/test/dispatch/show_exceptions_test.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.