about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/utils.c13
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 1052e53ee..745f1e3da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-09-20  Peter Stephenson  <pws@csr.com>
 
+	* 21737: Src/utils.c: unmetafy wordchars before looking for
+	mulitbyte characters.
+
 	* 21736: Src/init.c, Src/params.c, Src/pattern.c, Src/utils.c,
 	Src/Zle/zle.h, Src/Zle/zle_main.c: Fix WORDCHARS to use multibyte
 	characters; rationalise test for identifiers only to use ASCII
diff --git a/Src/utils.c b/Src/utils.c
index dce10beee..561624f51 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2499,15 +2499,18 @@ inittyptab(void)
     }
 #ifdef ZLE_UNICODE_SUPPORT
     if (wordchars) {
-	const char *wordchars_ptr = wordchars;
+	char *wordchars_unmeta;
+	const char *wordchars_ptr;
 	mbstate_t mbs;
-	int nchars;
+	int nchars, unmetalen;
+
+	wordchars_unmeta = dupstring(wordchars);
+	wordchars_ptr = unmetafy(wordchars_unmeta, &unmetalen);
 
 	memset(&mbs, 0, sizeof(mbs));
 	wordchars_wide = (wchar_t *)
-	    zrealloc(wordchars_wide, (strlen(wordchars)+1)*sizeof(wchar_t));
-	nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, strlen(wordchars),
-			   &mbs);
+	    zrealloc(wordchars_wide, (unmetalen+1)*sizeof(wchar_t));
+	nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, unmetalen, &mbs);
 	if (nchars == -1) {
 	    /* Conversion state is undefined: better just set to null */
 	    *wordchars_wide = L'\0';