lib/rabbit/source/base.rb in rabbit-0.6.2 vs lib/rabbit/source/base.rb in rabbit-0.6.3
- old
+ new
@@ -37,11 +37,13 @@
if @encoding.nil?
enc = guess_encoding(@source)
else
enc = @encoding
end
-
- unless /\Autf-?8\z/i =~ enc
+
+ if /\Autf-?8\z/i =~ enc
+ @source.force_encoding(enc) if @source.respond_to?(:force_encoding)
+ else
require "iconv"
@source = Iconv.conv("UTF-8", enc, @source)
end
end
@source