Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Needs to work on 1.8 too

  • Loading branch information...
commit 8e6a044b2b8baad14044bc615a0662f3510e54d5 1 parent 50b7c0c
@wycats wycats authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 actionpack/lib/action_view/template_handlers/erb.rb
View
7 actionpack/lib/action_view/template_handlers/erb.rb
@@ -12,7 +12,12 @@ class ERB < TemplateHandler
def compile(template)
magic = $1 if template.source =~ /\A(<%#.*coding[:=]\s*(\S+)\s*-?%>)/
- erb = "#{magic}<% __in_erb_template=true %>#{template.source}".force_encoding(template.source.encoding)
+ erb = "#{magic}<% __in_erb_template=true %>#{template.source}"
+
+ if erb.respond_to?(:force_encoding)
+ erb.force_encoding(template.source.encoding)
+ end
+
::ERB.new(erb, nil, erb_trim_mode, '@output_buffer').src
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.