1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add meta tag with charset information to application layout.

Previously, our default HTML would validate properly, but would generate
a warning: it doesn't declare a character encoding.

According to [the spec][encoding-spec], if you don't specify an
encoding, a 7 step algorithm happens, with a toooon of sub-steps. Or, we
could just actually specify it.

Since everything else in Rails assumes UTF-8, we should make sure pages
are served with that encoding too. This meta tag is the simplest way to
accomplish this.

More resources:

* http://blog.whatwg.org/the-road-to-html-5-character-encoding
* http://www.w3.org/International/tutorials/tutorial-char-enc/
* http://validator.w3.org/

[encoding-spec]: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#determining-the-character-encoding
This commit is contained in:
Steve Klabnik 2013-09-10 14:37:39 -07:00
parent e7facb35eb
commit ba0407337e

View file

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8">
<title><%= camelized %></title> <title><%= camelized %></title>
<%- if options[:skip_javascript] -%> <%- if options[:skip_javascript] -%>
<%%= stylesheet_link_tag "application", media: "all" %> <%%= stylesheet_link_tag "application", media: "all" %>