diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-31 14:06:21 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-31 14:06:21 -0800 |
commit | 916b74d16a5ed369ba58c17630f593470ca502a8 (patch) | |
tree | 9045eb57596e2f977fa23a85a10b1a2a2cb90c1d | |
parent | eda0f574f129fcd5ad1fc58b55cb6d1db71ea95c (diff) | |
download | rails-916b74d16a5ed369ba58c17630f593470ca502a8.tar.gz rails-916b74d16a5ed369ba58c17630f593470ca502a8.tar.bz2 rails-916b74d16a5ed369ba58c17630f593470ca502a8.zip |
use the source returned from encode!
-rw-r--r-- | actionview/lib/action_view/template.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 8ce8053011..a283d2467c 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -202,7 +202,9 @@ module ActionView # before passing the source on to the template engine, leaving a # blank line in its stead. def encode! - return unless source.encoding == Encoding::BINARY + source = self.source + + return source unless source.encoding == Encoding::BINARY # Look for # encoding: *. If we find one, we'll encode the # String in that encoding, otherwise, we'll use the @@ -290,7 +292,7 @@ module ActionView # In general, this means that templates will be UTF-8 inside of Rails, # regardless of the original source encoding. def compile(mod) - encode! + source = encode! code = @handler.call(self) # Make sure that the resulting String to be eval'd is in the @@ -312,7 +314,7 @@ module ActionView # handler is valid in the default_internal. This is for handlers # that handle encoding but screw up unless source.valid_encoding? - raise WrongEncodingError.new(@source, Encoding.default_internal) + raise WrongEncodingError.new(source, Encoding.default_internal) end mod.module_eval(source, identifier, 0) |