Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Quoting problem and crashes with ${(#)var}
- X-seq: zsh-workers 23177
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Quoting problem and crashes with ${(#)var}
- Date: Wed, 14 Feb 2007 16:19:51 +0000
- In-reply-to: <070214080347.ZM26428@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: Cambridge Silicon Radio
- References: <200702132111.l1DLB5rA003849@xxxxxxxxxxxxxxxxx>	<070213234815.ZM5424@xxxxxxxxxxxxxxxxxxxxxx>	<200702141016.l1EAGpKF016735@xxxxxxxxxxxxxx>	<070214080347.ZM26428@xxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> } Passing the character through the appropriate version of nicechar()
> } ought to help.
> 
> Unfortunately that doesn't seem to be enough:  the (V) flag is already
> calling nicedupstring().  It looks like wcs_nicechar() only uses the
> carat-character format for control characters less than 0x80?  ZLE
> must be doing its own printable conversion somewhere else.
Ah.  Try this.
Yes, I wasn't using "print -r", so the \u code got converted back to a raw
character.
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.156
diff -u -r1.156 utils.c
--- Src/utils.c	12 Feb 2007 16:43:42 -0000	1.156
+++ Src/utils.c	14 Feb 2007 16:18:14 -0000
@@ -514,10 +514,12 @@
 	    sprintf(buf, "\\U%.8x", (unsigned int)c);
 	    if (widthp)
 		*widthp = 10;
-	} else {
+	} else if (c >= 0x100) {
 	    sprintf(buf, "\\u%.4x", (unsigned int)c);
 	    if (widthp)
 		*widthp = 6;
+	} else {
+	    return nicechar((int)c);
 	}
 	if (swidep)
 	    *swidep = buf + *widthp;
-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author