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 16:15:08 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Mar 20, 2009 at 01:28:49PM -0500, Ben Duncan wrote:
> Well I have had no luck so far getting UTF-8 extended characters to display.
>
> Follows is my sample program .. am I doing something wrong here ?
>
> TIA ...
>
>
> #include <locale.h>
>
> #include <ncurses.h>

perhaps this (unless the packager does something special, ncursesw's header
is named "ncursesw.h").  Changing that, I do get a graphic character...

> #include <stdlib.h>
> #define ENTER 10
> #define ESCAPE 27
>
> void init_curses (  )
> {
>   initscr (  );
>   start_color (  );
>   init_pair ( 1, COLOR_WHITE, COLOR_BLUE );
>   init_pair ( 2, COLOR_BLUE, COLOR_WHITE );
>   init_pair ( 3, COLOR_RED, COLOR_WHITE );
>   curs_set ( 0 );
>   noecho (  );
>   keypad ( stdscr, TRUE );
> }
>
> int main (  )
> {
>   int key;
>
>   setlocale(LC_ALL, "");
>
>   wchar_t wide_char_t [] = { 0x20d4, 0x00 } ;
>
>   init_curses (  );
>
>   bkgd ( COLOR_PAIR ( 1 ) );
>
>   move ( 2, 1 );
>   printw ( "Let us test wide characters ... " );
>   printw ( "any key ends ...." );
>
>   /* SPECIAL characters ... */
>   move ( 4 , 2 ) ;
>   printw ( "Special char is : " ) ;
>
>   move ( 4 , 30 ) ;
>   addwstr ( wide_char_t ) ;
>   refresh (  );
>
>   key = getch (  );
>
>   endwin (  );
>   return 0;
> }
>
>
>
> Thomas Dickey wrote:
>> On Fri, 20 Mar 2009, Ben Duncan wrote:
>>
>>> Ok, thanks, Am on the right track. Update my ncurses library as well
>>> as xterm.
>>>
>
>
> -- 
> 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 <address@hidden>
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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