From 5ec2c7dc29b36d85b2658465b8a979deb0529d7e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 28 May 2009 17:12:28 -0500 Subject: Ruby 1.9: ERB template encoding using a magic comment at the top of the file --- actionpack/lib/action_view/template/handlers/erb.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'actionpack/lib/action_view/template/handlers') diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index 95f11d6490..d773df7d29 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -16,11 +16,7 @@ module ActionView self.default_format = Mime::HTML def compile(template) - src = ::ERB.new("<% __in_erb_template=true %>#{template.source}", nil, erb_trim_mode, '@output_buffer').src - - # Ruby 1.9 prepends an encoding to the source. However this is - # useless because you can only set an encoding on the first line - RUBY_VERSION >= '1.9' ? src.sub(/\A#coding:.*\n/, '') : src + ::ERB.new("<% __in_erb_template=true %>#{template.source}", nil, erb_trim_mode, '@output_buffer').src end end end -- cgit v1.2.3