Skip to content

Commit

Permalink
When reading line templates, scan the first two
Browse files Browse the repository at this point in the history
lines for magic comments, instead of just the
first. Also, scan for 'coding:' rather than
'encoding'.
  • Loading branch information
rkh committed Dec 13, 2010
1 parent 951c0b0 commit ff18f86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sinatra/base.rb
Expand Up @@ -923,8 +923,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
Expand Down

0 comments on commit ff18f86

Please sign in to comment.