Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/string.rb

Instance Method Summary collapse

Instance Method Details

#to_utf8Object



2
3
4
5
6
7
8
9
10
# File 'lib/ext/string.rb', line 2

def to_utf8
  if 1.8 == RUBY_VERSION.to_f
    require 'iconv'
    Iconv.conv('ISO-8859-1//TRANSLIT', 'utf-8', self)
  else
    self.encode('UTF-8')
    #why not self.force_encoding('UTF-8') ???
  end
end