Curses

I am an elementary user of ruby,i meet a problem about ruby curses.
source code as follow:

require “curses”
include Curses
init_screen
begin
crmode
echo
ch = getstr #problem occurred here
noecho
ensure
close_screen
end

I input some 2-byte-word (like chinese word) from the keyboard,but the
screen do not show the right result, finally I find that :

  1. I input only one 2-byte-word from the keyboard , the screen show me
    the first byte of the word but abandon the another byte of the word .
  2. I input two 2-byte-words from the keyboard, the second byte of each
    of the two 2-byte-words was abandoned, and the screen show me the result
    that it recompose a 2-byte-word by the first byte of each of the two
    2-byte-words

It sounds like curses doesn’t support unicode I looked around a little
bit on google and it looks like if you download the curses source code,
there is a way to compile it with unicode support. See the cached page
here:

http://72.14.205.104/search?q=cache:hI2PRe3SbOoJ:nullref.se/blog/2006/5/9/ruby-curses-unicode+ruby+unicode+curses&hl=en&ct=clnk&cd=1&gl=us&client=safari

On Oct 2, 2007, at 11:39 PM, 7stud – wrote:

+curses&hl=en&ct=clnk&cd=1&gl=us&client=safari

Posted via http://www.ruby-forum.com/.

You might want to check out the recent Ncurses book from Dan Gookin.
It’s in C, but so is curses anyway.
It should be adaptable to the Ruby gem version…

thank you very much!
but i can call addstr to show chinese word!

7stud – wrote:

It sounds like curses doesn’t support unicode I looked around a little
bit on google and it looks like if you download the curses source code,
there is a way to compile it with unicode support. See the cached page
here:

http://72.14.205.104/search?q=cache:hI2PRe3SbOoJ:nullref.se/blog/2006/5/9/ruby-curses-unicode+ruby+unicode+curses&hl=en&ct=clnk&cd=1&gl=us&client=safari

i am sorry about that i cann’t access the url above!

thank you all very much!
I solve the problem with another way to get the chinese word input by
using readline.so!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs