bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using UTF-8 with Ncurses / Xterm ....


From: Thomas Dickey
Subject: Re: Using UTF-8 with Ncurses / Xterm ....
Date: Fri, 20 Mar 2009 11:10:24 -0400 (EDT)

On Fri, 20 Mar 2009, Ben Duncan wrote:

Ok, thanks, Am on the right track. Update my ncurses library as well
as xterm.


Now, what I am trying to figure out is how to display some of the
more elaborate characters in UTF-8 ...

For example: http://www.fileformat.info/info/unicode/char/search.htm?q=arrow&preview=entity

Shows me the "ARROW" sets. Let say i want to display the character as defined
as :

Unicode Character 'COMBINING ANTICLOCKWISE ARROW ABOVE' (U+20D4)

How would I go about doing that with addch ?

Would it be something like : addch( 0x20d4) ?

A little more complicated: addch() only works for 8-bit data.
The analogous add_wch() uses cchar_t's, which can be made via setcchar.
(that seems to have been designed by a committee...)

The simplest way seems to be to put that 0x20d4 into an array of wchar_t's, and pass that as a wide-character string using waddnwstr().


On Thu, 19 Mar 2009, Ben Duncan wrote:

Can anyone point me to samples or documentation on how to
write C programs using UTF-8 for ncurses .

linking against ncursesw, and calling

    setlocale(LC_ALL, "");

is enough to make most programs display properly in UTF-8.
Doing input can be more complicated.

The test programs in ncurses' source provide a variety of examples.

<SNIP>

--
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road Jackson MS, 39212 "Never attribute to malice, that which can be adequately explained by stupidity"
      - Hanlon's Razor



_______________________________________________
Bug-ncurses mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-ncurses


--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]