summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/builtin.c6
-rw-r--r--Test/D07multibyte.ztst6
3 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index dd08827d4..12481c300 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-07 Peter Stephenson <pws@csr.com>
+
+ * 26945: Src/builtin.c, Test/D07multibyte.ztst: read should
+ pass through invalid multibyte characters.
+
2009-05-06 Clint Adams <clint@zsh.org>
* 26937: Completion/Unix/Command/_git: have `git log` complete
@@ -11661,5 +11666,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4677 $
+* $Revision: 1.4678 $
*****************************************************
diff --git a/Src/builtin.c b/Src/builtin.c
index b715e9782..d19ad01e2 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5546,8 +5546,12 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
wc = (wchar_t)c;
}
if (ret != MB_INCOMPLETE) {
- if (ret == MB_INVALID)
+ if (ret == MB_INVALID) {
memset(&mbs, 0, sizeof(mbs));
+ /* Treat this as a single character */
+ wc = (wchar_t)c;
+ laststart = bptr;
+ }
/*
* \ at the end of a line introduces a continuation line,
* except in raw mode (-r option)
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index 5c2abeaea..c7ee5791b 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -427,3 +427,9 @@
>Ą Пётр Ильич Чайковский 梶浦由記
>Ą Пётр Ильич Чайковский 梶浦由記
>Ą Пётр Ильич Чайковский 梶浦由記
+
+ setopt cbases
+ print $'\xc5' | read
+ print $(( [#16] #REPLY ))
+0:read passes through invalid multibyte characters
+>0xC5