bug-ncurses
[Top][All Lists]
Advanced

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

mvinnwstr() skips some complex character


From: Midolikawa H.
Subject: mvinnwstr() skips some complex character
Date: Thu, 26 Oct 2017 21:00:05 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Thank you for developing, maintaining and supporting ncurses.

I am now translating ncurses 6.0.20160213 manual pages into Japanese
informally, released in
http://www5a.biglobe.ne.jp/~espoir/ncurses_man_ja.html .

And I have noticed that sometimes mvinnwstr() skips
some complex character.

Test code (inwstr_test2.c) is here:
----------------------------------------
#include <curses.h>
#include <locale.h>
#include <stdlib.h>

//compile:
// gcc -I/usr/include/ncursesw/ -D_XOPEN_SOURCE_EXTENDED inwstr_test2.c -lncursesw

int main()
{
int ret, ret_long;
wchar_t wc[12+1];
wchar_t wc_long[20+1];
int i;

setlocale(LC_ALL,"");
initscr();
cbreak(); noecho(); halfdelay(100);

//display size
printw("%s\n", "### testing ### curs_inwstr / mvinnwstr() ###"  );
printw("NCURSES_VERSION : %s\n", NCURSES_VERSION );
printw("sizeof(wchar_t)  %d\n", sizeof(wchar_t)  );
//display test-string
mvprintw(3, 0, "%s\n", "สักกะทัตติยวิษณุกรรมประสิทธิ์"  );
refresh();

//get string
ret_long = mvinnwstr(3,0,wc_long,20);
ret = mvinnwstr(3,0,wc,12);

//put result
move(5,0);
printw("mvinnwstr(3,0,wc_long,20) =  %d\n", ret_long );
printw("mvinnwstr(3,0,wc,12) =  %d\n", ret );
addnwstr(wc_long, 20);
addstr("\n");
addnwstr(wc, 12);
addstr("\n");

//analyze unicode
for (i=0; i<=12; ++i)
    printw("%2d  %4x  %4x  \n", i, wc_long[i], wc[i]  );

refresh();
getch();

endwin();
return(0);
}
----------------------------------------

Unicode of characters in the (Thai-language) test-string are:
----------------------------------------
No. Unicode(Hexadecimal)
  1 0e2a 0e31
  2 0e01
  3 0e01 0e30
  4 0e17 0e31
  5 0e15
  6 0e15 0e34
  7 0e22
  8 0e27 0e34  *** skipped this character
  9 0e29
 10 0e13 0e38
 11 0e01
 12 0e23
 13 0e23
 14 0e21
 15 0e1b
 16 0e23 0e30
 17 0e2a 0e34
 18 0e17
 19 0e18 0e34 0e4c
 ----------------------------------------

On the result,
mvinnwstr(3,0,wc,12) has skipped 8th complex character, but got 9th.

PC:  DELL OPTIPLEX780
OS:  Ubuntu 16.04 LTS 64bit (Japanese Remix by Japanese Team)
APP: GNOME Terminal 3.18.3 / XTerm
VER: ncurses 6.0.20160213

Please help me understand this...

--
(^v^) (.. )(o^< >^o)
(( ))//^ ))(( ))(( ))
//mm //mm //mm //mm ================================^
.                                                  // \



reply via email to

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