git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use =20 when rfc2047 encoding spaces.

From
KHKristian Høgsberg <hoegsberg@gmail.com>
Date
Jun 1, 2007, 21:08 UTC
Message-ID
<11807320922292-git-send-email-hoegsberg@gmail.com>

Encode ' ' using '=20' even though rfc2047 allows using '_' for readability. Unfortunately, much software doesn't understand this and just leaves the underscore in place. Using '=20' seems to work better.

Signed-off-by: Kristian Høgsberg <hoegsberg@gmail.com>
---
 commit.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/commit.c b/commit.c
index bee066f..92b46f1 100644
--- a/commit.c
+++ b/commit.c
@@ -511,12 +511,14 @@ static int add_rfc2047(char *buf, const char *line, int len,
 	bp += i;
 	for (i = 0; i < len; i++) {
 		unsigned ch = line[i] & 0xFF;
-		if (is_rfc2047_special(ch)) {
+		/* We encode ' ' using '=20' even though rfc2047
+		 * allows using '_' for readability.  Unfortunately,
+		 * doesn't understand this and just leaves the
+		 * underscore in place. */
+		if (is_rfc2047_special(ch) || ch == ' ') {
 			sprintf(bp, "=%02X", ch);
 			bp += 3;
 		}
-		else if (ch == ' ')
-			*bp++ = '_';
 		else
 			*bp++ = ch;
 	}
-- 
1.5.0.6
Next: Jeffrey C. Ollie
Message 1 of 5 in “Use =20 when rfc2047 encoding spaces.”
  1. Use =20 when rfc2047 encoding spaces.Kristian Høgsberg, Jun 1, 2007
  2. Jeffrey C. OllieJun 1, 2007
  3. Junio C HamanoJun 2, 2007
  4. Junio C HamanoJun 2, 2007
  5. Update to SubmittingPatchesJohannes Schindelin, Jun 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.