Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - curses and unicode

 
Thread Tools Search this Thread
Old 04-15-2004, 07:46 AM   #1
Default curses and unicode



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
  Reply With Quote
Old 04-15-2004, 07:29 PM   #2
A.M. Kuchling
 
Posts: n/a
Default Re: curses and unicode
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
  Reply With Quote
Old 04-15-2004, 10:25 PM   #3
David M. Cooke
 
Posts: n/a
Default Re: curses and unicode
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46