Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Terminal UTF-8 output via ncursesw

 
   Macintosh computer (Home) -> General Discussion RSS
Next:  getting live slider info  
Author Message
Christoph

External


Since: Jun 14, 2006
Posts: 1



(Msg. 1) Posted: Wed Jun 14, 2006 8:39 am
Post subject: Terminal UTF-8 output via ncursesw
Archived from groups: comp>sys>mac>programmer>misc (more info?)

Hi all,

I'm having problems getting UTF-8 output from ncurses on the Mac OS X
Terminal. Vim (using "set encoding=utf-8") and direct output to the
terminal work, so I guess the terminal is up correctly (I've set LC_ALL
to en_US.UTF-8). I've compiled my own ncurses so that I can be sure
it's been compiled with the --enable-widec option.

Currently I'm trying around with the following snippet (in which
<c3><84> represent the associated hex codes):

#include <ncursesw/ncurses.h>
int main(int argc, char *argv[])
{
initscr();
addstr("<c3><84>");
refresh();
getch();
endwin();
return 0;
}

Simply outputting the raw .c text file to the terminal via "cat" gives
the correct output in the "addstr" line: an A-umlaut "Ä". Compiling it
via

gcc -I $MY_NCURSES_DIR/include utf8test.c -L$MY_NCURSES_DIR/lib
-lncursesw

works without any error, but running the resulting code only results in
a "?~D" output (two charachters, without the quotes). As far as I've
understood the ncurses-docs, UTF-8 output is supposed to work using the
normal output routines, and the special wide routines like "addwstr"
are only required for wchar_t types.

I guess I'm doing something very simple wrong here, but I just have no
idea what. Maybe someone's got an idea?

Thanks in advance,
Christoph.

 >> Stay informed about: Terminal UTF-8 output via ncursesw 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]