def encode(s)
      return s if s.nil?
      return s if s.valid_encoding?
      if s.force_encoding("iso-8859-1").valid_encoding?
        return s.encode('utf-8', 'iso-8859-1')
      end
      s
    end
def encode(s)
      return s if s.nil?
      return s if s.valid_encoding?
      if s.force_encoding("iso-8859-1").valid_encoding?
        return s.encode('utf-8', 'iso-8859-1')
      end
      s
    end
Handle any string encoding