zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: printf %<n>s in UTF-8 is not always POSIX-compliant
Date: Wed, 15 Feb 2012 11:05:19 +0000	[thread overview]
Message-ID: <20120215110519.2ea11f1a@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <120215001413.ZM22585@torch.brasslantern.com>

On Wed, 15 Feb 2012 00:14:12 -0800
Bart Schaefer <schaefer@brasslantern.com> 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" é'
> 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.

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.

-- 
Peter Stephenson <pws@csr.com>            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, Cambridge 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


  parent reply	other threads:[~2012-02-15 11:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15  2:15 Vincent Lefevre
2012-02-15  8:14 ` Bart Schaefer
2012-02-15  9:10   ` Vincent Lefevre
2012-02-15 11:05   ` Peter Stephenson [this message]
2012-02-15 11:53     ` Vincent Lefevre
2012-02-15 12:09       ` Frank Terbeck
2012-02-15 12:23         ` Peter Stephenson
2012-02-15 12:42         ` Vincent Lefevre
2012-02-15 14:42   ` Oliver Kiddle
2012-02-15 14:56     ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120215110519.2ea11f1a@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).