Commit 2d791bf7 authored by Fabio Pelosin's avatar Fabio Pelosin

[rbx] Encode only if needed.

parent 425a5c16
......@@ -153,9 +153,9 @@ module Pod
def self.from_file(path)
podfile = Podfile.new do
string = File.open(path, 'r:utf-8') { |f| f.read }
# TODO: work around for Rubinius incomplete encoding in 1.9 mode
string = File.open(path, 'r') { |f| f.read }
string.encode!('UTF-8') if string.respond_to?(:encode!)
string.encode!('UTF-8') if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
eval(string, nil, path.to_s)
end
podfile.defined_in_file = path
......
......@@ -4,9 +4,9 @@ module Pod
extend Config::Mixin
def self._eval_podspec(path)
string = File.open(path, 'r:utf-8') { |f| f.read }
# TODO: work around for Rubinius incomplete encoding in 1.9 mode
string = File.open(path, 'r') { |f| f.read }
string.encode!('UTF-8') if string.respond_to?(:encode!)
string.encode!('UTF-8') if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
eval(string, nil, path.to_s)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment