Skip to content

Commit

Permalink
UTF-8 encoding issue fix was dropped for some reason. Here it is again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Iskander authored and Tom Dale committed Dec 15, 2010
1 parent 9375561 commit 4a87713
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vendor/chance/lib/chance.rb
Expand Up @@ -16,12 +16,12 @@ class << self
def add_file(path, content=nil)
mtime = 0
if content.nil?
mtime = File.new(path).mtime
mtime = File.mtime(path).to_f
end

if @files[path]
mtime = File.new(path).mtime
update_file(path) if mtime > @files[path][:mtime]
mtime = File.mtime(path).to_f
update_file(path, content) if mtime > @files[path][:mtime]
return
end

Expand All @@ -44,7 +44,7 @@ def update_file(path, content=nil)

mtime = 0
if content.nil?
mtime = File.new(path).mtime
mtime = File.mtime(path).to_f
end

file = {
Expand Down Expand Up @@ -87,7 +87,8 @@ def get_file(path)
file = @files[path]

if file[:content].nil?
f = File.open(path, "rb")
# note: CSS files should be opened as UTF-8.
f = File.open(path, path =~ /css$/ ? 'r:UTF-8' : 'rb')
file[:content] = f.read
f.close
end
Expand Down

0 comments on commit 4a87713

Please sign in to comment.