26954: read should pass through invalid multibyte characters

This commit is contained in:
Peter Stephenson 2009-05-07 16:04:21 +00:00
parent 4f622ad570
commit a6ff95d0c1
3 changed files with 17 additions and 2 deletions

View file

@ -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 $
*****************************************************

View file

@ -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)

View file

@ -427,3 +427,9 @@
>Ą Пётр Ильич Чайковский 梶浦由記
>Ą Пётр Ильич Чайковский 梶浦由記
>Ą Пётр Ильич Чайковский 梶浦由記
setopt cbases
print $'\xc5' | read
print $(( [#16] #REPLY ))
0:read passes through invalid multibyte characters
>0xC5