From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12305 invoked by alias); 23 Dec 2009 10:51:32 -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: 27539 Received: (qmail 14771 invoked from network); 23 Dec 2009 10:51:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED autolearn=ham version=3.2.5 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.219.220 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=L0DH1VwVeiTioIElnynHAzYz3fB6ckDeCzOoIJzWRk4=; b=l8PTugWaVW+VoYKNaCuZe1RuX2TpWBXYj044TlvRVaaS7k9miXzglSsI38oCUKCxqf aw0iXf8GKcQPUw+ssfI/D7LbljaXhus1FwUDWGOgTgUedVJH1MpiiDm/wXr1rkEEWdWR 3sHOttT9/bUrqU1jeum6VaZqbTntiwBp7Wvl8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=pWzxgUUDvCXhH1Wof9bcFFYq+bPlVqjxTgMs96o+GSDT1Y9vaYYHAjILyURlNjGqto StuhGSCUJEZj1GHFbHDWUPUD8vpvClyuv+pYtdPG0mlAZQd81kiYX+0JbWTOAD9ek1J8 YFNyG2F1o6sewmtnEdGZxyrTxIRoBm97cfv3s= MIME-Version: 1.0 Date: Wed, 23 Dec 2009 11:44:51 +0100 Message-ID: <237967ef0912230244i2ea13dfav734535262871db7e@mail.gmail.com> Subject: vared/zle silently discards non-utf8 bytes From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have this function function name() { [[ $#@ -eq 1 ]] || { echo Give exactly one argument ; return 1 } test -e "$1" || { echo No such file or directory: "$1" ; return 1 } local newname=3D$1 if vared -c -p 'rename to: ' newname && [[ -n $newname && $newname !=3D $1 ]] then command mv -i -- $1 $newname else echo Some error occured; return 1 fi } which I use to rename files interactively if they just need small adjustments. It would also be useful for files in wrong encodings where there's a =C3=BC here or there. Unfortunately it seems vared discards anything after an invalid byte. To reproduce, just do % a=3Dhi$'\374'nothing % vared a It actually seems main zle does this too (I thought it would do the <0374> thing, but then realized those are unicode code points so that wouldn't work), but it's much harder to hit since completion inserts the $'\374' sequence for you and there's really no simple way to insert the string. If you start a terminal in latin1 and run a command with some upper byte, then press up-arrow in a utf8 terminal, everything after that byte is silently discarded too. I care less about this case personally. --=20 Mikael Magnusson