aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Pimenov <libc@mac.com>2009-02-05 07:10:03 +0300
committerJeremy Kemper <jeremy@bitsweat.net>2009-02-06 11:03:41 -0800
commitb1c1e3deb7d752292abaff34ba66a3eae030d252 (patch)
treed39be6e1efe05e722f14c86e23fb1bc242953858
parentae36fcedce1ffcf4f3331b444ea1779987c6615a (diff)
downloadrails-b1c1e3deb7d752292abaff34ba66a3eae030d252.tar.gz
rails-b1c1e3deb7d752292abaff34ba66a3eae030d252.tar.bz2
rails-b1c1e3deb7d752292abaff34ba66a3eae030d252.zip
Ruby 1.9 compat: change encoding of action_view/renderable to utf-8, so erb templates can use utf-8 properly
[#1881 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
-rw-r--r--actionpack/lib/action_view/renderable.rb2
-rw-r--r--actionpack/test/fixtures/test/utf8.html.erb2
-rw-r--r--actionpack/test/template/render_test.rb9
3 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/renderable.rb b/actionpack/lib/action_view/renderable.rb
index 153e14f68b..cb774d8248 100644
--- a/actionpack/lib/action_view/renderable.rb
+++ b/actionpack/lib/action_view/renderable.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
module ActionView
# NOTE: The template that this mixin is being included into is frozen
# so you cannot set or modify any instance variables
diff --git a/actionpack/test/fixtures/test/utf8.html.erb b/actionpack/test/fixtures/test/utf8.html.erb
new file mode 100644
index 0000000000..0b4d19aa0e
--- /dev/null
+++ b/actionpack/test/fixtures/test/utf8.html.erb
@@ -0,0 +1,2 @@
+Русский текст
+日本語のテキスト \ No newline at end of file
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index c7405d47de..2caf4e8fe4 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
require 'abstract_unit'
require 'controller/fake_models'
@@ -204,6 +205,14 @@ module RenderTestCases
assert_equal %(<title>title</title>\n<div id="column">column</div>\n<div id="content">content</div>\n),
@view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")
end
+
+ if '1.9'.respond_to?(:force_encoding)
+ def test_render_utf8_template
+ result = @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
+ assert_equal "Русский текст\n日本語のテキスト", result
+ assert_equal Encoding::UTF_8, result.encoding
+ end
+ end
end
class CachedViewRenderTest < Test::Unit::TestCase