Hello! I'm trying to use wcwith replacement on Solaris 8 and have noticed some problems. At first, the test for replacement did not detect the problem and thus did not replace the system function (patch for this is attached). Then I have noticed that the replacement function is slow and broken.
At least rpl_wcwidth(0x00AB) returns 0, but it should return 1 for the character. 0x00AB is LEFT-POINTING DOUBLE ANGLE QUOTATION MARK. Note that rpl_wcwidth(0x00BB) returns 1 properly. 0x00BB is the companion char RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK. The slowness is probably caused by checking the charset string every time wcwidth is called. I'm not sure which way to fix it would be correct, probably caching the check result will help. BTW, why not use this one: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c ? It's public domain. -- Alexander.
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 index 04a9fc2..348594e 100644 --- a/m4/wcwidth.m4 +++ b/m4/wcwidth.m4 @@ -38,6 +38,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH], else dnl On MacOS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl On Solaris 8, wcwidth(0x2022) (BULLET) returns -1. dnl This leads to bugs in 'ls' (coreutils). AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], [gl_cv_func_wcwidth_works], @@ -64,7 +65,7 @@ int wcwidth (int); int main () { if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) - if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0) + if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0 || wcwidth(0x2022) < 1) return 1; return 0; }], [gl_cv_func_wcwidth_works=yes], [gl_cv_func_wcwidth_works=no],