[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ncurses-bug
Subject:    Re: Multibyte UTF8 charaters outputs 4 bytes on terminal
From:       suvidh kankariya <suvidh.kankariya () ntigo ! com>
Date:       2012-07-09 13:47:05
Message-ID: 4FFAE0D9.8080608 () ntigo ! com
[Download RAW message or body]

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



_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-ncurses

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic