[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Shawn Whoo

10/3/2007 2:54:00 AM

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
--
Posted via http://www.ruby-....

5 Answers

7stud 7stud

10/3/2007 4:40:00 AM

0

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&cli...
--
Posted via http://www.ruby-....

John Joyce

10/3/2007 5:07:00 AM

0


On Oct 2, 2007, at 11:39 PM, 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:nullre...
> 2006/5/9/ruby-curses-unicode+ruby+unicode
> +curses&hl=en&ct=clnk&cd=1&gl=us&client=safari
> --
> Posted via http://www.ruby-....
>
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...

Shawn Whoo

10/4/2007 7:09:00 AM

0

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

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

Shawn Whoo

10/4/2007 7:12:00 AM

0

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&cli...


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

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

Shawn Whoo

10/5/2007 5:30:00 AM

0

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

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