From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19718 invoked from network); 5 Mar 2008 00:27:40 -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.6 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; 5 Mar 2008 00:27:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 48205 invoked from network); 5 Mar 2008 00:27:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Mar 2008 00:27:33 -0000 Received: (qmail 6613 invoked by alias); 5 Mar 2008 00:27:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24679 Received: (qmail 6597 invoked from network); 5 Mar 2008 00:27:28 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 5 Mar 2008 00:27:28 -0000 Received: from prunille.vinc17.org (vinc17.pck.nerim.net [213.41.242.187]) by bifrost.dotsrc.org (Postfix) with ESMTP id C69F88028C67 for ; Wed, 5 Mar 2008 01:27:24 +0100 (CET) Received: by prunille.vinc17.org (Postfix, from userid 501) id AF82820879F7; Wed, 5 Mar 2008 01:27:21 +0100 (CET) Date: Wed, 5 Mar 2008 01:27:21 +0100 From: Vincent Lefevre To: zsh-workers@sunsite.dk Subject: Re: printf %s in UTF-8 is not POSIX-compliant Message-ID: <20080305002721.GF15833@prunille.vinc17.org> Mail-Followup-To: zsh-workers@sunsite.dk References: <20080304012917.GA15833@prunille.vinc17.org> <200803040940.m249e7DC012517@news01.csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200803040940.m249e7DC012517@news01.csr.com> X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.17-vl-r21552 (2008-03-02) X-Virus-Scanned: ClamAV 0.91.2/6129/Wed Mar 5 01:13:00 2008 on bifrost X-Virus-Status: Clean On 2008-03-04 09:40:07 +0000, Peter Stephenson wrote: > That seems to me useless. But that what's POSIX requires (and this hasn't changed in the latest draft). Also, there may be reasons (e.g. file formats with limited field sizes). So, zsh should follow the specification, at least when it emulates sh, since the user may write scripts based on it. > I can understand in C that a string is a low-level entity consisting > of a set of bytes, but I don't see why a shell should force the user > to count the size of a multibyte character in the particular locale. Well, there could be an extension to give the sizes in characters instead of bytes. > You can fix it by unsetting the MULTIBYTE option. > > printf() { emulate -L zsh; unsetopt multibyte; builtin printf "$@" } There's a missing semi-colon: printf() { emulate -L zsh; unsetopt multibyte; builtin printf "$@"; } -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)