From: William Morgan Date: 2010-05-10T22:45:35+09:00 Subject: Re: wcswidth, ruby 1.9, and string encodings Reformatted excerpts from Tanaka Akira's message of 2010-05-09: > I wrote such code in my terminfo binding. > http://github.com/akr/ruby-terminfo Very nice. It works when I use your git version. But the latest gem (v0.1.1) doesn't seem to have wcswidth. > I used rb_locale_encoding() to convert to LC_CTYPE as follows: > > str = rb_str_encode(str, rb_enc_from_encoding(rb_locale_encoding()), 0, Qnil); Perfect, that's what I was missing. I need one other bit of functionality too: the ability to get a substring of a specific display width. I assume that is beyond the scope of your terminfo package, so I am probably going to wrap the two methods up into a gem. But if you're planning on adding such a thing to ruby-terminfo, let me know, and I will just use that instead. Thanks for your help! -- William