From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15298 invoked by alias); 15 Feb 2012 11:05:47 -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: 30223 Received: (qmail 17587 invoked from network); 15 Feb 2012 11:05:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Wed, 15 Feb 2012 11:05:19 +0000 From: Peter Stephenson To: Subject: Re: printf %s in UTF-8 is not always POSIX-compliant Message-ID: <20120215110519.2ea11f1a@pwslap01u.europe.root.pri> In-Reply-To: <120215001413.ZM22585@torch.brasslantern.com> References: <20120215021519.GA19525@xvii.vinc17.org> <120215001413.ZM22585@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.101.10.170] X-Scanned-By: MailControl 7.6.6 (www.mailcontrol.com) on 10.71.0.142 On Wed, 15 Feb 2012 00:14:12 -0800 Bart Schaefer wrote: > The reason it's different for "emulate sh" is that sh emulation turns > off all support for multibyte characters (unsetopt multibyte). If you > were to do > emulate sh -c 'setopt multibyte; printf ".%2s.\n" =C3=A9' > then I believe you'd see the same behavior as with "emulate ksh". >=20 > As to whether it's correct ... I think I'd prefer the logical rather > than literal interpretation, but it'll be difficult [or a hack that > requires looking at the global emulation state, so it won't be possible > to reproduce it with plain setopts] to turn off multibyte processing in > printf for ksh emulation but not native zsh. This sounds correct... We've never promised ksh mode would be a complete representation of ksh anyway. I realise that, for historical reasons related to standards rather than zsh, you'd expect ksh mode to be POSIX compatible, but actually we don't tend to bother because ksh mode isn't that widely used and so doesn't get a lot of attention (I certainly never use it). If you really want compatibility native zsh mode or sh mode are the sensible choices. So probably the fix is to spread fear, uncertainty and doubt about ksh mode. I'll start right now. If there is a hard-core ksh mode user who'd like to maintain it, of course, that's another story. --=20 Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, = UK Member of the CSR plc group of companies. CSR plc registered in England and= Wales, registered number 4187346, registered office Churchill House, Cambr= idge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http= ://twitter.com/CSR_PLC and read our blog at www.csr.com/blog