Permalink
Browse files

[rbx] Encode only if needed.

  • Loading branch information...
1 parent 425a5c1 commit 2d791bf7e119f2ef3f8b490962521d4cda952e63 @fabiopelosin fabiopelosin committed Jun 8, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/cocoapods/podfile.rb
  2. +2 −2 lib/cocoapods/specification.rb
View
4 lib/cocoapods/podfile.rb
@@ -153,9 +153,9 @@ def empty?
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
View
4 lib/cocoapods/specification.rb
@@ -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

1 comment on commit 2d791bf

@alloy
CocoaPods member

WIN!

Please sign in to comment.