use the source returned from encode!

上级 eda0f574
......@@ -202,7 +202,9 @@ def inspect
# 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 @@ def compile!(view)
# 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 @@ def #{method_name}(local_assigns, output_buffer)
# 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册