Method: Pipl::Utils.to_utf8

Defined in:
lib/pipl/utils.rb

.to_utf8(obj) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pipl/utils.rb', line 34

def to_utf8(obj)
  if obj.respond_to?(:encode)
    begin
      obj.encode('UTF-8')
    rescue Exception
      puts "Could not convert #{obj} to UTF-8"
      raise
    end
  else
    obj
  end
end