summary refs log tree commit diff
path: root/mmime.c
diff options
context:
space:
mode:
Diffstat (limited to 'mmime.c')
-rw-r--r--mmime.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/mmime.c b/mmime.c
index 5e25082..c46b0a5 100644
--- a/mmime.c
+++ b/mmime.c
@@ -245,13 +245,19 @@ print_header(char *line) {
 			}
 			if (s < e) {
 				if (linelen + (e-s)+13 > 78) {
-					printf("\n");
-					linelen = 0;
+					printf("\n ");
+					linelen = 1;
+				}
+				if (highbit || s[0] == ' ') {
+					printf("=?UTF-8?Q?");
+					linelen += 13;
+					linelen += gen_qp((uint8_t *)s, e-s, 999, 1);
+					printf("?=");
+				} else {
+					fwrite(s, 1, e-s, stdout);
+					linelen += e-s;
+					prevq = 0;
 				}
-				printf(" =?UTF-8?Q?");
-				linelen += 13;
-				linelen += gen_qp((uint8_t *)s, e-s, 999, 1);
-				printf("?=");
 			}
 			prevq = 1;
 		} else {