ncurses ruby and utf-8

Discussion in 'Ruby' started by Brian Schröder, Mar 7, 2005.

  1. hello group,

    I'm writing a small application using ncurses and I wonder how to make
    it output and input utf-8 characters. I also have a readline interface
    to the program, and there I can input things like û ö ñ etc. quite
    fine, using the ncurses routines it chokes.
    I'm using the getstr(str) call for text input.

    Thanks,

    Brian
     
    Brian Schröder, Mar 7, 2005
    #1
    1. Advertisements

  2. * Brian Schröder (Mar 07, 2005 13:40):
    You need ncursesw (configure --enable-widec).

    Check the archive (http://www.ruby-talk.org/) for previous discussions
    (Simon Strandgaard has done some investigation into using it from Ruby).

    The ruby-ncurses package currently doesn't support wide character
    ncurses,
    nikolai
     
    Nikolai Weibull, Mar 7, 2005
    #2
    1. Advertisements

  3. Brian Schröder

    Lee Braiden Guest

    What is the general state of unicode support in ruby?
     
    Lee Braiden, Mar 7, 2005
    #3
  4. * Lee Braiden (Mar 07, 2005 14:40):
    There is none, beyond a very hackish one for regular expression
    matching via the $KCODE variable (and -K command-line option). Ruby 2.0
    will fix this, hopefully in a wonderful way (I'm talking total coverage,
    i.e, strings, io, regexes, and so on), so that character set and
    character encoding is handled as transparently as possible (i.e, we as
    Ruby programmers don't have to lift a finger),
    nikolai
     
    Nikolai Weibull, Mar 7, 2005
    #4
  5. Brian Schröder

    Lee Braiden Guest

    Ahh. Is there an official guess on when 2.0 will happen? Best estimate I can
    find is 2006-ish?
     
    Lee Braiden, Mar 7, 2005
    #5
  6. * Lee Braiden (Mar 07, 2005 16:10):
    That sounds like a wishful estimate. However, if I get the time (which
    I won't), I'll probably hack something together as a suggestion for
    Unicode support. matz has commented on some parts of the future
    semantics of Strings, but there's still a lot to figure out, I'd say,
    nikolai
     
    Nikolai Weibull, Mar 7, 2005
    #6
  7. Simon Strandgaard, Mar 7, 2005
    #7
  8. Brian Schröder, Mar 8, 2005
    #8
  9. Brian Schröder

    Cs. Henk Guest

    I just wonder how is it possible that a language which originated in
    Japan doesn't support unicode & co. out of the box. They do need unicode
    for proper handling of their character sets, don't they? How is it
    possible historically that noone cared about it?

    Csaba
     
    Cs. Henk, Mar 9, 2005
    #9
  10. Brian Schröder

    Dido Sevilla Guest

    No. Before Unicode there were already several different ways of
    encoding Japanese text (just as we English speakers have had ASCII and
    EBCDIC in the past), and Unicode is only one of them. Apparently
    Unicode isn't even the dominant way of doing so just yet: the JIS
    encodings seem to be more popular at the moment, and there are even
    three variations of JIS (Shift-JIS is by far the most widely used for
    Japanese web pages and such, and ISO-2022-JP is most widely used for
    Japanese email, and Japanese locales on Unix/Linux use the JIS EUC
    encoding).

    See this site for more information on this complicated topic:

    http://www.cs.mcgill.ca/~aelias4/encodings.html
     
    Dido Sevilla, Mar 9, 2005
    #10
  11. Dido Sevilla ha scritto:
    Also notice that there is an old debate about unicode *not* being good
    enough for japanese and other languages, for example:
    http://tronweb.super-nova.co.jp/unicoderevisited.html
    (I really don't understand a lot about encoding, anyway)
     
    gabriele renzi, Mar 9, 2005
    #11
  12. Brian Schröder

    Cs. Henk Guest

    This is interesting, thanks for the pointer! But then, how are these
    popular schemes supported by ruby? Isn't it possible/desirable to use a
    generic scheme which can be realized then either as unicode or as one of
    the above encodings?

    Csaba
     
    Cs. Henk, Mar 9, 2005
    #12
  13. Hi,

    In message "Re: ncurses ruby and utf-8"

    |This is interesting, thanks for the pointer! But then, how are these
    |popular schemes supported by ruby? Isn't it possible/desirable to use a
    |generic scheme which can be realized then either as unicode or as one of
    |the above encodings?

    Ruby Regexp can handle these encodings (i.e. EUC-JP, Shift_JIS, UTF-8).

    matz.
     
    Yukihiro Matsumoto, Mar 10, 2005
    #13
  14. Looking through your wrapper, I have not recognized anything that would
    be specific to ncursesw, and differ from narrow-character ncurses (apart
    from wrapping wcwidth, which seems to live in libc).

    So I wonder what it would take to make ncurses-ruby wide-character
    compatible. Could you give me a hint where to start?

    Thanks,
    Tobias
     
    Tobias Peters, Mar 12, 2005
    #14
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.