Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh generates invalid UTF-8 encoding in the history
- X-seq: zsh-workers 39582
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: zsh generates invalid UTF-8 encoding in the history
- Date: Thu, 6 Oct 2016 11:31:12 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=zEUCpMpAngfKXnkHTVU3Ruooy2KYvVJdTifU1b+9FvA=; b=kSbp41ZUA+UgOlDdJXBsgj9CP3Xwxnr8PbX/L/8qjOgarNkwwfYajvHxTXwBrAgLrW 4+2QWbYl2JmYM3/kCqR4i0VCsdjIG5vg68lxzslsay7aBwUML/rQ4TYyGriY8L1UeAZT YhxqcBq031hf1R5qXBIvMYRonSFQzsIaELjYI2l3k/ecs7YKia/58IOdRdV0la0wLmjh vlzeCACkfVNGTsrLcZEqJRyiC7HbZGO+qecwSFUOFfI++PWWWVt5s8y+F1RCEUShay6K aDZn7HuuMvqR5Ke7vIbLhmgvSEvUyDly9o6ysdJthf/hHjXiPYzSdf97Ljxv+o1c4DtW N0zQ==
- In-reply-to: <CAHYJk3TvMyW05V7aXOvX2s1u-BMtFCx6-4GBRHj25FeJ_OBaDg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20161005114848.GA1125@cventin.lip.ens-lyon.fr> <CAHYJk3TvMyW05V7aXOvX2s1u-BMtFCx6-4GBRHj25FeJ_OBaDg@mail.gmail.com>
On Oct 5, 2:41pm, Mikael Magnusson wrote:
}
} History entries are written in metafied form to the history file. You
} can use the 'history' command to print a readable version of history,
} or use this small utility http://mika.l3ib.org/code/unmetafy.c
Nice little utility, but it doesn't handle converting "\\\n" into "\n".
Maybe that's not desirable anyway, as the downstream utility might
want to do that itself.
To unmetafy with the shell (including backslash-newline processing):
() { fc -pa $HISTFILE $SAVEHIST && fc -rnl -1 1 }
Or more generically
unmetafy() {
() { fc -pa $1 ${$(wc -l $1)[1]} && fc -rnl -1 1 } ${1:-=(cat)}
}
Vincent might also consider using a zshaddhistory hook to maintain a copy
of the history file that is unmetafied and stripped of extended-history
markup, though that gets a bit more complicated.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author