perl version oddity
[exim.git] / src / src / string.c
index cd76e1f1c1ec27d37e42cfe6b821b13d0562afef..170b47b238fd2e353dbc635d4f7aaf45e8d15e1d 100644 (file)
@@ -1623,7 +1623,7 @@ while (*fp)
       goto INSERT_GSTRING;
       }
 
-    case 'W':                  /* Maybe mark up spaces & newlines */
+    case 'W':                  /* Maybe mark up ctrls, spaces & newlines */
       s = va_arg(ap, char *);
       if (Ustrpbrk(s, " \n") && !IS_DEBUG(D_noutf8))
        {
@@ -1646,7 +1646,15 @@ while (*fp)
              if (precision >= 0) precision += 3;
              break;
            default:
-             zg = string_catn(zg, CUS s, 1);
+             if (*s <= ' ')
+               {       /* base of UTF8 symbols for ASCII control chars */
+               uschar ctrl_symbol[3] = {[0]=0xe2, [1]=0x90, [2]=0x80};
+               ctrl_symbol[2] |= *s;
+               zg = string_catn(zg, ctrl_symbol, 3);
+               if (precision >= 0) precision += 2;
+               }
+             else
+               zg = string_catn(zg, CUS s, 1);
              break;
            }
          }
@@ -1698,7 +1706,7 @@ while (*fp)
        }
 
       /* If a width is not specified and the precision is specified, set
-      the width to the precision, or the string length if shorted. */
+      the width to the precision, or the string length if shorter. */
 
       else if (precision >= 0)
        width = precision < slen ? precision : slen;