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 Friedman | Author of IronRuby Unleashed Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Tue, Mar 23, 2010 at 5:02 PM, Mark Rendle <m...@markrendle.net> wrote: > 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:in `toutf8' > 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:in `eval_input' > from C:/ironruby/lib/ruby/1.8/irb.rb:263:in `signal_status' > from C:/ironruby/lib/ruby/1.8/irb.rb:147:in `eval_input' > from C:/ironruby/lib/ruby/1.8/irb.rb:146:in `eval_input' > from C:/ironruby/lib/ruby/1.8/irb.rb:70:in `start' > from C:/ironruby/lib/ruby/1.8/irb.rb:69:in `catch' > from C:/ironruby/lib/ruby/1.8/irb.rb:69:in `start' > from C:/ironruby/bin/iirb:13 > > Is there another way of converting to UTF-8 which is support in IronRuby? > > Cheers, > Mark > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core@rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core