Martijn Dekker <martijn@xxxxxxxx> wrote: > > ...'case' is broken for multi-byte characters. The following test script, when > saved in UTF-8, outputs 'BUG' instead of 'ok': > > case "ρ" in > ( "ρ" ) echo ok ;; > ( * ) echo BUG; exit 1 ;; > esac Thanks for the report. This patch should fix it: ---8<--- MBCHAR should be preserved in argstr if the EXP_MBCHAR bit is set. This broke case statements. Reported-by: Martijn Dekker <martijn@xxxxxxxx> Fixes: 6c44f4ee0c2b ("parser: Add support for multi-byte characters") Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> --- src/expand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expand.c b/src/expand.c index 5285b79..93bb9a3 100644 --- a/src/expand.c +++ b/src/expand.c @@ -371,7 +371,7 @@ addquote: c = (signed char)*p--; mb = mbnext(p); ml = (mb >> 8) - 2; - if (flag & QUOTES_ESC) { + if (flag & (QUOTES_ESC | EXP_MBCHAR)) { length = (mb >> 8) + (mb & 0xff); if (c == (char)CTLESC) startloc += length; -- 2.39.2 -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt