Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Unicode quote characters

On Wed, 4 Jan 2012 13:44:09 +0100
Tollef Fog Heen <tfheen@xxxxxx> wrote:
> (please Cc me on replies, I'm not subscribed)
> Currently, zsh doesn't support using “”, ‘’ and so on as quotation
> characters (so they'd work like '' and "" do).  Would it be possible to
> add support for that

Not easily, no.  The core shell is fairly heavily tied to what POSIX
calls the "portable character set", i.e. essentially US ASCII.  It
relies on other character sets being an extension of this.  Multibyte
characters, which are how the shell sees the command input, are treated
as an opaque stream of octets that the shell takes care not to treat as
internal processing tokens.  So any change to do this that I can think
of (without having thought through the details) looks either quite ad
hoc (hacking in a few arbitrary characters from one particular character
set the shell doesn't otherwise recognise as special) or quite
sophisticated (defining a general mapping from multibyte characters to
syntactic objects).  The fact that the opening and closing quotes are
different is an additional difficulty (though probably not that
difficult if the other bits could be done; there is already some
flexibility about this within the shell to cope with different sorts of

> and maybe also something along the lines of perl's q// and qq// syntax?

Not impossible given the right syntax; I suppose it would have to be
another hack with $-something, like $', which doesn't fill me with
inspiration.  However, parsing of shells is rather different from normal
programming languages, so it doesn't fit in as well.  The tricks for
quoting shell words tend to be rather different from Perl (and often
quite obscure).

Peter Stephenson <pws@xxxxxxx>            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

Messages sorted by: Reverse Date, Date, Thread, Author