Permalink
Browse files

When reading line templates, scan the first two

lines for magic comments, instead of just the
first. Also, scan for 'coding:' rather than
'encoding'.
  • Loading branch information...
1 parent 0ed8e87 commit 1450e0690112d5d9edd03acb92313f74f697ba72 @rkh rkh committed Dec 13, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sinatra/base.rb
View
@@ -919,8 +919,8 @@ def inline_templates=(file=nil)
end
if data
- if app and app.lines.first =~ /^\s*#\W*encoding\W*(\w[\w_\-\.\d]+)\W*$/
- encoding = $1
+ if app and app =~ /([^\n]*\n)?#[^\n]*coding: *(\S+)/m
+ encoding = $2
else
encoding = settings.default_encoding
end

0 comments on commit 1450e06

Please sign in to comment.