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: Ben Duncan
Subject: Re: Using UTF-8 with Ncurses / Xterm ....
Date: Fri, 20 Mar 2009 13:28:49 -0500
User-agent: Thunderbird 2.0.0.19 (X11/20081209)

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>
#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





reply via email to

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