curses and unicode

Discussion in 'Python' started by Gandalf, Apr 15, 2004.

  1. Gandalf

    Gandalf Guest

    Hi All!

    I have to write an application that can display Chinese charaters in
    text mode under unix. I found several text mode console programs (like
    zhcon and big5d).
    They are able to use English and Chinese characters at the same time, in
    text mode. (In fact, they are using graphics, but they emulate a
    standard terminal.)
    Do somebody know how can I display chinese characters from curses (using
    one of these console programs)? I'm sure it can be done. For example,
    midnight commander or lynx can do this:

    http://zhcon.sourceforge.net/images/scr_mc.gif

    But I do not know how to do this from Python. I only have the curses
    module and the addstr method. The addstr method does not support unicode.
    Should I send a special character sequence with addstr? I'm totally
    lost. I tried to read the documentation of zhcon but it is in Chinese
    which I
    do not understand. :-( Please help me.

    G
     
    Gandalf, Apr 15, 2004
    #1
    1. Advertising

  2. On Thu, 15 Apr 2004 08:46:55 +0200,
    Gandalf <> wrote:
    > But I do not know how to do this from Python. I only have the curses
    > module and the addstr method. The addstr method does not support unicode.


    There's a separate set of interfaces for wide-character curses support, with
    functions such as addwstr(). Unfortunately the Python curses module doesn't
    support these functions, and they may or may not be available on your
    platform. (For example, they don't seem to be available in the version of
    ncurses in Debian unstable.)

    --amk
     
    A.M. Kuchling, Apr 15, 2004
    #2
    1. Advertising

  3. At some point, "A.M. Kuchling" <> wrote:

    > On Thu, 15 Apr 2004 08:46:55 +0200,
    > Gandalf <> wrote:
    >> But I do not know how to do this from Python. I only have the curses
    >> module and the addstr method. The addstr method does not support unicode.

    >
    > There's a separate set of interfaces for wide-character curses support, with
    > functions such as addwstr(). Unfortunately the Python curses module doesn't
    > support these functions, and they may or may not be available on your
    > platform. (For example, they don't seem to be available in the version of
    > ncurses in Debian unstable.)


    You want the libncursesw5 library (ncurses compiled with wide
    character support). I suppose there's two libraries as
    ncurses-with-wide-chars is API but not ABI compatible with
    ncurses-w/o-wide-chars. But, no Python interface with wide characters.

    --
    |>|\/|<
    /--------------------------------------------------------------------------\
    |David M. Cooke
    |cookedm(at)physics(dot)mcmaster(dot)ca
     
    David M. Cooke, Apr 15, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jean-Paul Calderone
    Replies:
    2
    Views:
    465
    Joel Hedlund
    Feb 9, 2006
  2. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    1,024
    Grzegorz ¦liwiñski
    Jan 19, 2011
  3. Chirag Mistry
    Replies:
    6
    Views:
    190
    Ollivier Robert
    Feb 8, 2008
  4. Steven D'Aprano

    Curses unicode support

    Steven D'Aprano, Sep 1, 2012, in forum: Python
    Replies:
    1
    Views:
    260
  5. Terry Reedy
    Replies:
    0
    Views:
    93
    Terry Reedy
    Jan 7, 2014
Loading...

Share This Page