From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29531 invoked from network); 6 Mar 2008 17:45:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Mar 2008 17:45:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75228 invoked from network); 6 Mar 2008 17:45:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Mar 2008 17:45:41 -0000 Received: (qmail 14059 invoked by alias); 6 Mar 2008 17:45:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24696 Received: (qmail 14040 invoked from network); 6 Mar 2008 17:45:38 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 Mar 2008 17:45:38 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 3BD1B8029404 for ; Thu, 6 Mar 2008 18:45:33 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly02g.srv.mailcontrol.com (MailControl) with ESMTP id m26Hj60S024379 for ; Thu, 6 Mar 2008 17:45:28 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 6 Mar 2008 17:45:23 +0000 Date: Thu, 6 Mar 2008 17:45:23 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: printf %s in UTF-8 is not POSIX-compliant Message-ID: <20080306174523.15633059@news01> In-Reply-To: <080306090901.ZM21797@torch.brasslantern.com> References: <20080304012917.GA15833@prunille.vinc17.org> <200803040940.m249e7DC012517@news01.csr.com> <20080305002721.GF15833@prunille.vinc17.org> <200803051041.m25AfmUc031042@news01.csr.com> <080306090901.ZM21797@torch.brasslantern.com> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Mar 2008 17:45:23.0228 (UTC) FILETIME=[DA8705C0:01C87FB1] X-Scanned-By: MailControl A-08-00-05 (www.mailcontrol.com) on 10.71.0.112 X-Virus-Scanned: ClamAV 0.91.2/6154/Thu Mar 6 17:41:42 2008 on bifrost X-Virus-Status: Clean On Thu, 06 Mar 2008 09:09:01 -0800 Bart Schaefer wrote: > I think "emulate sh" should emulate the POSIX shell to the greatest > extent possible. If that means turning off MULTIBYTE, turn it off. That seems basically sensible. > However, if "emulate bash" is going to mean something other than a > synonym for "sh", then some effort should be put into being a bit > closer to bash than it's currently possible to be. For example, > at least set the various BASH_* options, the way "emulate csh" sets > the smattering of CSH_* options. I'm not sure the first sentence agrees with the second. Are you suggesting new options? > A final thought on MULTIBYTE: Is it perhaps reasonable to split this > into two options, one that affects line editor operations and one that > affects internals? If someone does "emulate sh; setopt zle" it seems > there might be some expectation that ZLE can adapt to a terminal that > displays multibyte even if the input is all treated as raw bytes once > accept-line hands it off. That might mean that e.g. _main_complete > needs to look at the state of ZLE_MULTIBYTE (or whatever) and setopt > MULTIBYTE locally to correspond. Other widgets could also be affected, > so the emphasis here is on "reasonable." I think it can be done, and is reasonable if done properly, but is likely to be bug-prone in the case where one option is on and the other off. The library code (mostly in utils.c) will need the correct option passing down to it, widgets (including basic zle widgets) will need to be careful, and the combination isn't likely to get well-tested anyway. Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.56 diff -u -r1.56 options.yo --- Doc/Zsh/options.yo 1 Feb 2008 19:59:48 -0000 1.56 +++ Doc/Zsh/options.yo 6 Mar 2008 17:36:57 -0000 @@ -427,10 +427,10 @@ Append a trailing `tt(/)' to all directory names resulting from filename generation (globbing). ) -pindex(MULTIBYTE ) +pindex(MULTIBYTE) cindex(characters, multibyte, in expansion and globbing) cindex(multibyte characters, in expansion and globbing) -item(tt(MULTIBYTE))( +item(tt(MULTIBYTE) )( Respect multibyte characters when found in strings. When this option is set, strings are examined using the system library to determine how many bytes form a character, depending @@ -438,8 +438,10 @@ pattern matching, parameter values and various delimiters. The option is on by default if the shell was compiled with -tt(MULTIBYTE_SUPPORT); otherwise it is off by default and has no effect if -turned on. +tt(MULTIBYTE_SUPPORT) except in tt(sh) emulation; otherwise it is off by +default and has no effect if turned on. The mode is off in tt(sh) +emulation for compatibility but for interative use may need to be +turned on if the terminal interprets multibyte characters. If the option is off a single byte is always treated as a single character. This setting is designed purely for examining strings Index: Src/options.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/options.c,v retrieving revision 1.38 diff -u -r1.38 options.c --- Src/options.c 19 Dec 2007 21:49:35 -0000 1.38 +++ Src/options.c 6 Mar 2008 17:36:57 -0000 @@ -173,7 +173,7 @@ {{NULL, "monitor", OPT_SPECIAL}, MONITOR}, {{NULL, "multibyte", #ifdef MULTIBYTE_SUPPORT - OPT_ALL + OPT_EMULATE|OPT_ZSH|OPT_CSH|OPT_KSH #else 0 #endif -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070