From: Emmanuel Touzery Date: 2003-12-22T21:40:59+09:00 Subject: Re: string to UTF Piergiuliano Bossi wrote: > Mark J. Reed wrote: > >> Use the iconv library, which comes with Ruby 1.8. > > > Is iconv available on Windows 1.8.0 PragProg distribution? > > C:\TEMP\x>ruby -v > ruby 1.8.0 (2003-08-04) [i386-mswin32] > >> You have to know >> what encoding you're starting with - ISO-8859-1 (a.k.a Latin-1) or >> whatever your local character set is. Note the order of arguments >> in Iconv.open: the target character set comes first, then the source >> character set. >> >> irb(main):001:0> require 'iconv' >> => true > > > Not for me: > > irb(main):001:0> require 'iconv' > LoadError: No such file to load -- iconv > from (irb):1:in `require' > from (irb):1 > irb(main):002:0> VERSION > => "1.8.0" > > Trying your code in a file named 'tryconv.rb': > > require 'iconv' > convertor = Iconv.open("UTF-8", "ISO-8859-1") > strUTF = convertor.iconv("test") > > I get: > > C:\TEMP\x>ruby tryconv.rb > ./iconv.rb:2: uninitialized constant Iconv (NameError) > from tryconv.rb:1:in `require' > from tryconv.rb:1 yes, i reported this recently. it's a pretty bad problem for me :O/ i hope somebody smarter than me will fix it... emmanuel