From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27885 invoked by alias); 15 Feb 2012 08:14:30 -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: 30221 Received: (qmail 13440 invoked from network); 15 Feb 2012 08:14:18 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120215001413.ZM22585@torch.brasslantern.com> Date: Wed, 15 Feb 2012 00:14:12 -0800 In-reply-to: <20120215021519.GA19525@xvii.vinc17.org> Comments: In reply to Vincent Lefevre "printf %s in UTF-8 is not always POSIX-compliant" (Feb 15, 3:15am) References: <20120215021519.GA19525@xvii.vinc17.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: printf %s in UTF-8 is not always POSIX-compliant MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable On Feb 15, 3:15am, Vincent Lefevre wrote: } } In UTF-8 locales: }=20 } xvii% printf ".%2s.\n" =E9 } .=E9. Am I understanding correctly that the intent here is that =E9 is a two- byte character so %2s should print the two literal bytes, rather than print the single logical character in a field two logical characters wide? 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" =E9' then I believe you'd see the same behavior as with "emulate ksh". 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.