Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: print -v with multibyte characters
- X-seq: zsh-workers 45483
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsugabubus <zsugabubus@national.shitposting.agency>
- Subject: Re: print -v with multibyte characters
- Date: Thu, 20 Feb 2020 23:58:48 +0100
- Cc: zsh-workers@xxxxxxx
- In-reply-to: <20200220190310.tms2xcwk3sjmqb76@localhost>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20200220190310.tms2xcwk3sjmqb76@localhost>
On 2/20/20, zsugabubus <zsugabubus@national.shitposting.agency> wrote:
> Hi,
>
> $ echo $ZSH_VERSION
> 5.7.1
> $ export {LC_ALL,LANG}=en_US.UTF-8
> $ set -o multibyte && echo ok
> ok
>
> Good:
> $ print ÖÓŐöóő
> ÖÓŐöóő
> $ printf -v var ÖÓŐöóő; echo $var
> ÖÓŐöóő
>
> Bad:
> $ print -v var ÖÓŐ; echo $var
> öó
> $ print -v var öóő; echo $var
> öóŃ
This gets closer to correct, but seems to leave out the final byte or
two, or change it somehow,
diff --git i/Src/builtin.c w/Src/builtin.c
index 168bf8863b..ed26717b5b 100644
--- i/Src/builtin.c
+++ w/Src/builtin.c
@@ -4848,8 +4848,7 @@ bin_print(char *name, char **args, Options ops, int func)
if (ret)
free(buf);
else
- setsparam(OPT_ARG(ops, 'v'),
- metafy(buf, rcount, META_REALLOC));
+ setsparam(OPT_ARG(ops, 'v'), buf);
unqueue_signals();
}
return ret;
@@ -4972,8 +4971,7 @@ bin_print(char *name, char **args, Options ops, int func)
if (ret)
free(buf);
else
- setsparam(OPT_ARG(ops, 'v'),
- metafy(buf, rcount, META_REALLOC));
+ setsparam(OPT_ARG(ops, 'v'), buf);
unqueue_signals();
}
return ret;
Incidentally you can use print -v var -f %s ÖÓŐ; echo $var to work
around the problem (the handling for -f uses different code which
doesn't have the bug).
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author