From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28099 invoked from network); 11 May 2007 18:43:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, MSGID_FROM_MTA_HEADER,UNPARSEABLE_RELAY autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 May 2007 18:43:01 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 2145 invoked from network); 11 May 2007 18:42:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 May 2007 18:42:55 -0000 Received: (qmail 1953 invoked by alias); 11 May 2007 18:42:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23432 Received: (qmail 1943 invoked from network); 11 May 2007 18:42:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 May 2007 18:42:53 -0000 Received: (qmail 1844 invoked from network); 11 May 2007 18:42:53 -0000 Received: from smtpout.mac.com (17.250.248.181) by a.mx.sunsite.dk with SMTP; 11 May 2007 18:42:49 -0000 Received: from webmail011 (webmail011-s [10.13.128.11]) by smtpout.mac.com (Xserve/smtpout11/MantshX 4.0) with ESMTP id l4BIgIj0016832; Fri, 11 May 2007 11:42:19 -0700 (PDT) Date: Fri, 11 May 2007 11:42:18 -0700 From: Jordan Breeding To: Peter Stephenson Cc: zsh-workers@sunsite.dk Message-ID: <2DF07A7A-0112-1000-89C4-08869130C191-Webmail-10013@mac.com> in-reply-to: <20070511185602.f76af8ed.pws@csr.com> references: <20070510175541.GA67479@redoubt.spodhuis.org> <20070510222647.GA45037@redoubt.spodhuis.org> <200705110928.l4B9Sobe019086@news01.csr.com> <2DF07A7A-0112-1000-86BB-08869130C191-Webmail-10013@mac.com> <2DF07A7A-0112-1000-87C3-08869130C191-Webmail-10013@mac.com> <20070511185602.f76af8ed.pws@csr.com> Subject: Re: problems with 4.3.4 and Tru64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: 199.171.212.100 Received: from [199.171.212.100] from webmail.mac.com with HTTP; Fri, 11 May 2007 11:42:18 -0700 X-Brightmail-Tracker: AAAAAA== X-Brightmail-scanned: yes On Friday, May 11, 2007, at 12:56PM, "Peter Stephenson" wrote= : >Jordan Breeding wrote: >> Sorry to reply to myself, but I just paid a little bit more attention >> and I figured out something else interesting. The extra characters >> that appear in the Terminal itself just before the output from echo >> are the multibyte characters only, which are missing from the ${1} >> being inserted into the Terminal title. This part seems to be OS X >> (Terminal.app) specific, as if I use zsh through a remote Terminal >> the behaviour will differ (putty will display >> hlp in the title which I am assuming are just >> the bytes that it is seeing). Anyway, I will probably just not use >> preexec() anymore for now. Is there are way to display multibyte >> characters as the base singlebyte character for the preexec string? >> Or possible just replace multibyte characters with "?" or something, >> just so my preexec would at least partially work? > >I'm glad things are working better... I'd be happy to put any generic >workarounds in the shell itself, but it's probably too difficult for >a terminal-specific problem, if that's what this is. > >As for detecting multibyte characters: presumably all characters with >codes over 127 are going to be multibyte, so it is possible to detect >such a string: > >% foo=3D"=C3=A4" >% print $(( #foo )) > >228 > >However, this just tests the first character; you'd have to loop over the >entire string to do it which is a bit of a nuisance: > > local line=3D${(%):-'\e]2;%n@%m %0~ (%30>...>'${1}'%>>%)\a'} char > local -a arr > arr=3D(${(s..)line}) > integer i > for (( i =3D 1; i <=3D ${#arr}; i++)); do > char=3D${arr[i]} > (( #char > 127 )) && arr[i]=3D"?" > done > print -n ${(j..)arr} > >(I did test this.) I wonder if the shell is misinterpreting codes within >the ${1} in > > print -Pn "\e]2;%n@%m %0~ (%30>...>${1}%>>%)\a" > >? If you just do print -P "" from the command line with >what was in ${1} does everything look OK? (This is rather a long shot; >I don't see how the shell could misplace characters like that, but >it might be getting the handling of characters sufficiently wrong >that the terminal driver is getting confused.) > Hmm, while it is kind of annoying to have to loop over the whole string, it= isn't horrible, and it fixes the problems in both of my common terminals. = Also, I did your other test, ${1} is intact, so it definitely isn't the sh= ell, it is the terminal programs. Thanks for the help! Jordan