]> git.pond.sub.org Git - empserver/commitdiff
(copy_ascii_no_funny, copy_utf8_no_funny)
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 14 Jun 2005 05:01:26 +0000 (05:01 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 14 Jun 2005 05:01:26 +0000 (05:01 +0000)
(copy_utf8_to_ascii_no_funny): Don't consider newline funny.  This
fixes output filtering broken in rev. 1.17.

src/lib/subs/pr.c

index 1baf343cf3a96c75d79c5da479f3418eca0567ef..5eab12c8b3a4791199cab2ff521c30574e5ed16e 100644 (file)
@@ -507,8 +507,8 @@ copy_ascii_no_funny(char *dst, char *src)
 
     p = dst;
     while ((ch = *src++)) {
 
     p = dst;
     while ((ch = *src++)) {
-       if ((ch < 0x20 && ch != '\t') || ch == 0x7f)
-           ;                   /* ignore control */
+       if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
+           ;                   /* ignore funny control */
        else if (ch > 0x7f)
            *p++ = '?'; /* replace non-ASCII */
        else
        else if (ch > 0x7f)
            *p++ = '?'; /* replace non-ASCII */
        else
@@ -536,8 +536,8 @@ copy_utf8_no_funny(char *dst, char *src)
     p = dst;
     while ((ch = *src++)) {
        /* FIXME do the right thing for malformed and overlong sequences */
     p = dst;
     while ((ch = *src++)) {
        /* FIXME do the right thing for malformed and overlong sequences */
-       if ((ch < 0x20 && ch != '\t') || ch == 0x7f)
-           ;                   /* ignore control */
+       if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
+           ;                   /* ignore funny control */
        else
            *p++ = ch;
     }
        else
            *p++ = ch;
     }
@@ -563,8 +563,8 @@ copy_utf8_to_ascii_no_funny(char *dst, char *src)
     p = dst;
     while ((ch = *src++)) {
        /* FIXME do the right thing for malformed and overlong sequences */
     p = dst;
     while ((ch = *src++)) {
        /* FIXME do the right thing for malformed and overlong sequences */
-       if ((ch < 0x20 && ch != '\t') || ch == 0x7f)
-           ;                   /* ignore control */
+       if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
+           ;                   /* ignore funny control */
        else if (ch > 0x7f) {
            *p++ = '?';         /* replace non-ASCII */
            while ((*src++ & 0xc0) == 0x80) ;
        else if (ch > 0x7f) {
            *p++ = '?';         /* replace non-ASCII */
            while ((*src++ & 0xc0) == 0x80) ;