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

Re: Quoting problem and crashes with ${(#)var}



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