Missing method in NKF module

I’m trying to use the waz-storage gem for talking to Windows Azure
storage
services, but it uses kconv and there’s a problem with the toutf8 mix-in
method, which is trying to call NKF.nkf, which is not defined.

Repro:

irb(main):001:0> require ‘kconv’
=> true
irb(main):002:0> “foo”.toutf8
NoMethodError: undefined method nkf' for NKF:Module from C:/ironruby/lib/ruby/1.8/kconv.rb:187:intoutf8’
from C:/ironruby/lib/ruby/1.8/kconv.rb:327:in toutf8' from (irb):2 from C:/ironruby/lib/ruby/1.8/irb.rb:150:ineval_input’
from C:/ironruby/lib/ruby/1.8/irb.rb:263:in signal_status' from C:/ironruby/lib/ruby/1.8/irb.rb:147:ineval_input’
from C:/ironruby/lib/ruby/1.8/irb.rb:146:in eval_input' from C:/ironruby/lib/ruby/1.8/irb.rb:70:instart’
from C:/ironruby/lib/ruby/1.8/irb.rb:69:in catch' from C:/ironruby/lib/ruby/1.8/irb.rb:69:instart’
from C:/ironruby/bin/iirb:13

Is there another way of converting to UTF-8 which is support in
IronRuby?

Cheers,
Mark

Maybe the .NET’s System.Text.Encoding class:

bytes = Encoding.convert(Encoding.ASCII, Encoding.UTF8,
Encoding.ASCII.get_bytes(“Hello”.to_clr_string))
=> [72 (Byte), 101 (Byte), 108 (Byte), 108 (Byte), 111 (Byte)]
Encoding.UTF8.get_string(bytes)
=> ‘Hello’

Shay.

Shay F. | Author of IronRuby Unleashed
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

I’ll give that a try, thanks.