c - Why does wcwidth return -1 with a sign that I can print on the terminal? -


why here wcwidth return "-1" (not printable wide character) width "Ԥ" (0x0524)?

#include <stdio.h> #include <wchar.h> #include <locale.h>  int wcwidth(wchar_t wc);  int main() {     setlocale(lc_ctype, "");      wchar_t wc1 = l'合'; // 0x5408     int width1 = wcwidth(wc1);     printf("%lc - print width: %i\n", wc1, width1);      wchar_t wc2 = l'Ԥ'; // 0x0524     int width2 = wcwidth(wc2);     printf("%lc - print width: %i\n", wc2, width2);      return 0; }  output:  合 - print width: 2 Ԥ - print width: -1 

most u+0524 not valid character when libc character database created. added in unicode 5.2. font may include character already, wcwidth not @ font used.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -