From a6ff95d0c1b3874f27baa6dbec9699ac987c110b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 7 May 2009 16:04:21 +0000 Subject: 26954: read should pass through invalid multibyte characters --- ChangeLog | 7 ++++++- Src/builtin.c | 6 +++++- Test/D07multibyte.ztst | 6 ++++++ 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 + + * 26945: Src/builtin.c, Test/D07multibyte.ztst: read should + pass through invalid multibyte characters. + 2009-05-06 Clint Adams * 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 -- cgit 1.4.1