bug-ncurses
[Top][All Lists]
Advanced

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

Re: Multibyte UTF8 charaters outputs 4 bytes on terminal


From: suvidh kankariya
Subject: Re: Multibyte UTF8 charaters outputs 4 bytes on terminal
Date: Mon, 09 Jul 2012 09:47:05 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100722 Eudora/3.0.4

Thanks for the pointer Thomas.
My target system did not had utf8 locale installed. Once I did that it started working.


Regards

Suvidh




On 7/6/2012 8:59 AM, Thomas Dickey wrote:
On Thu, Jul 05, 2012 at 02:05:29PM -0700, Suvidh wrote:
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*/

     setlocale(LC_ALL,"en_US.utf-8");
If your machine's locale configuration doesn't contain this item,
setlocale will fail (silently) and your locale will be POSIX.

For that case, I see
U�~C�S

If you've verified that it does contain it, e.g.,
        locale -a |fgrep en_US.utf-8

then it's something I should look at more closely.






reply via email to

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