fix encoding issue in Ruby 1.9
This commit is contained in:
parent
2e774b2a97
commit
a7dfe1152d
@ -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?
|
||||
|
@ -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'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user