[Top][All Lists]

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

Multibyte UTF8 charaters outputs 4 bytes on terminal

From: Suvidh
Subject: Multibyte UTF8 charaters outputs 4 bytes on terminal
Date: Thu, 5 Jul 2012 14:05:29 -0700 (PDT)

I am trying simple code to display multibyte(3 bytes in this case) UTF8
character. However I see 4 ascii character instead.
The middle UTF8 byte gets converted to 2 ascii characters resulting in 4
symbols on putty terminal configured for UTF8 and japanese font. 
Ncurses versions :tried  5.7 and 5.9 and application is linked with
lncursesw library.
Ncurses is cross compiled for ARM architecture.
I see proper character when using printf. So my terminal settings are good.
Wondering what exactly I am missing. 
I will highly appreciate any pointer or patch on this .

Here is a snippet of code I am using.

 char tmp_buf[10];
    tmp_buf[0] = 'U';
    tmp_buf[1] = 0xE3;
    tmp_buf[2] = 0x83;
    tmp_buf[3] = 0xA6;
    tmp_buf[4] = 'S';
    tmp_buf[5] = '\0';
    printf(tmp_buf);   /*This prints the character correctly*/

    printw(tmp_buf);   /*This gives unexpected result*/

View this message in context: 
Sent from the Gnu - Ncurses mailing list archive at Nabble.com.

reply via email to

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