fix encoding issue in Ruby 1.9

This commit is contained in:
dinedine 2011-01-27 14:07:10 +01:00
parent 2e774b2a97
commit a7dfe1152d
2 changed files with 12 additions and 2 deletions

View File

@ -70,7 +70,11 @@ class ThemeAsset
end
def plain_text
@plain_text ||= self.source.read
if RUBY_VERSION =~ /1\.9/
@plain_text ||= self.source.read.force_encoding('UTF-8')
else
@plain_text ||= self.source.read
end
end
def performing_plain_text?

View File

@ -113,7 +113,13 @@ module Locomotive
@theme_file = File.join(self.themes_folder, @identifier)
File.open(@theme_file, 'w') { |f| f.write(uploader.file.read) }
if RUBY_VERSION =~ /1\.9/
bytes = uploader.file.read.force_encoding('UTF-8')
else
bytes = uploader.file.read
end
File.open(@theme_file, 'w') { |f| f.write(bytes) }
else # local filesystem
self.log 'file from local storage'