From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9779 invoked by alias); 6 Oct 2016 18:30:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39582 Received: (qmail 23787 invoked from network); 6 Oct 2016 18:30:52 -0000 X-Qmail-Scanner-Diagnostics: from mail-pa0-f50.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.220.50):SA:0(0.0/5.0):. Processed in 0.739379 secs); 06 Oct 2016 18:30:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=zEUCpMpAngfKXnkHTVU3Ruooy2KYvVJdTifU1b+9FvA=; b=LNY5Rzh7M4330EKYFJ3venqswA9+w1KNCyG5LV4vaEstqDt5J7gO1d6cqVU0Is/s8G nonW65vPANKqvg0R0hs35LRH9rVLutZ1Paa3GhgY1ldLDFmQabUTOd4rvx7J9B6bDFRQ 1FKvWeAKqcKQWaeUZKX1ji0NWiHOrvq7WtZEtKomxof+MD4kq3sn5g1z8vvjlscLps0z 2kowg+ngYXczkz6lxga+PWwhQ3ktk/6+FOJrKWVDUKPk+j88VZZpV+n0wV1wPz/QdcL/ 0kloQWiUxl3uzumHc3cPkDwOkIjIexqCU7Pdm3RCE5RvVfSt9Qo8mAwewiRqKGt8a8in lELw== X-Gm-Message-State: AA6/9RlVHUlOADy4eKTyVPlsxnR0Wxu8hJ+QsQD0BK9qJT3GwPettZEMxxBzW/v+Z8B85g== X-Received: by 10.66.184.74 with SMTP id es10mr24139795pac.187.1475778642552; Thu, 06 Oct 2016 11:30:42 -0700 (PDT) From: Bart Schaefer Message-Id: <161006113112.ZM16191@torch.brasslantern.com> Date: Thu, 6 Oct 2016 11:31:12 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: zsh generates invalid UTF-8 encoding in the history" (Oct 5, 2:41pm) References: <20161005114848.GA1125@cventin.lip.ens-lyon.fr> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: zsh generates invalid UTF-8 encoding in the history MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.