I think it might be better to do something like this [see patch]: The iscntrl() test can be replaced easily if more/less paranoia is required - it's not really fair to expect apps to figure out the escape sequence is just gone, as afaict there's no way to ask if a term supports many of them other than checking TERM and going by what you know/expect that terminal to support.
--- charproc.orig.c Mon Jan 7 21:02:44 2002 +++ charproc.c Sat Jul 12 13:12:45 2003 @@ -3591,8 +3591,15 @@ int n, c; for (n = 0; n < length; n++) { char *s = list[n]; - while ((c = *s++) != '\0') - unparseputc(c, screen->respond); + while ((c = *s++) != '\0') { + if( iscntrl(c) ) { + char e[4]; + snprintf( e, 4, "%%%02x", c ); + e[3] = 0; + unparseputs(e,screen->respond); + } else + unparseputc(c,screen->respond); + } } XFreeStringList(list); }