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

PATCH: Capitalize a parameter containing combined characters



I did some quick tests of parameter expansion with combined characters,
and found a small bug:

zsh$ x=éfg            # é is a combined character, e + U+0301
zsh$ echo ${(C)x}     # capitalize
ÉFg                   # should be "Éfg"

This may be fixed, for example, by the patch below.

Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.75
diff -u -r1.75 hist.c
--- Src/hist.c	17 Apr 2008 10:23:53 -0000	1.75
+++ Src/hist.c	26 Apr 2008 16:53:56 -0000
@@ -1567,6 +1567,8 @@

 	    case CASMOD_CAPS:
 	    default:		/* shuts up compiler */
+		if (IS_COMBINING(wc))
+			break;
 		if (!iswalnum(wc))
 		    nextupper = 1;
 		else if (nextupper) {


-----
Jun


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