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: Thomas Dickey
Subject: Re: Multibyte UTF8 charaters outputs 4 bytes on terminal
Date: Fri, 06 Jul 2012 08:59:45 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

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.

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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