diff options
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | bin/erb | 2 | ||||
-rw-r--r-- | test/erb/test_erb_command.rb | 6 |
3 files changed, 9 insertions, 1 deletions
@@ -143,6 +143,8 @@ with all sufficient information, see the ChangeLog file or Redmine * ERB * Add ERB#result_with_hash to render a template with local variables passed with a Hash object. [Feature #8631] + * Default template file encoding is changed from ASCII-8BIT to UTF-8 in erb + command. [Bug #14095] * Carriage returns are changed to be trimmed properly if trim_mode is specified and used. Duplicated newlines will be removed on Windows. [Bug #5339] [Bug #11464] @@ -122,7 +122,7 @@ EOU exit 1 end - $<.set_encoding(Encoding::ASCII_8BIT, nil) + $<.set_encoding(Encoding::UTF_8, nil) src = $<.read filename = $FILENAME exit 2 unless src diff --git a/test/erb/test_erb_command.rb b/test/erb/test_erb_command.rb index 406b14cdb3..7e2b874632 100644 --- a/test/erb/test_erb_command.rb +++ b/test/erb/test_erb_command.rb @@ -9,4 +9,10 @@ class TestErbCommand < Test::Unit::TestCase "var=hoge"], "<%=var%>", ["hoge"]) end + + def test_template_file_encoding + assert_in_out_err(["-w", + File.expand_path("../../../bin/erb", __FILE__)], + "<%=''.encoding.to_s%>", ["UTF-8"]) + end end |