Skip to contentSkip to conversation

Use =20 when rfc2047 encoding spaces.

PATCH In review Kristian Høgsberg 4 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use =20 when rfc2047 encoding spaces.

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.

---
 commit.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
commit.c +5 -3
index bee066f..92b46f1 100644
@@ -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;
 	}
Signature · 1 line
1.5.0.6
#1 lore raw

commit.c static int add_rfc2047(char *buf, const char *line, int len, · line 518

Quoted 7 lines · Kristian Høgsberg
commit.c +5 -1
-		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 == ' ') {

Looks like "much software" got left out of the comment.

Jeff

#2 lore raw
In reply to Kristian Høgsberg
Quoted 2 lines · Kristian Høgsberg

Encode ' ' using '=20' even though rfc2047 allows using '_' for readability..

Thanks.

Your message was marked as iso-8859-1 even though it was utf-8 (your signed-off-by line), so I'll fix it up with your From:
header.

#3 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 2 lines · Kristian Høgsberg

Encode ' ' using '=20' even though rfc2047 allows using '_' for readability..

Thanks.

Your message was marked as iso-8859-1 even though it was utf-8 (your signed-off-by line), so I'll fix it up with your From:
header.

Oh, another thing. Before you submit a patch, make sure the whole testsuite in t/ passes by running "make test".

#4 lore raw

PATCH 1/1 Update to SubmittingPatches

Make people aware of our testsuite, and of non-ASCII encodings.

---

On Sat, 2 Jun 2007, Junio C Hamano wrote:

> Junio C Hamano <[email protected]> writes:
>
> > Kristian Høgsberg <[email protected]> writes:
> >
> >> Encode ' ' using '=20' even though rfc2047 allows using '_' for > >> readability..
> >
> > Thanks.
> >
> > Your message was marked as iso-8859-1 even though it was utf-8 > > (your signed-off-by line), so I'll fix it up with your From:
> > header.
>
> Oh, another thing. Before you submit a patch, make sure the > whole testsuite in t/ passes by running "make test".

We should remind people of both.

 Documentation/SubmittingPatches |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Documentation/SubmittingPatches +4 -0
index b5f2ecd..b6e5847 100644
@@ -14,6 +14,8 @@ Checklist (and a short version for the impatient):
 	  commit message (or just use the option "-s" when
 	  committing) to confirm that you agree to the Developer's
 	  Certificate of Origin
+	- make sure that you have tests for the bug you are fixing
+	- make sure that the test suit passes after your commit
 
 	Patch:
 
@@ -33,6 +35,8 @@ Checklist (and a short version for the impatient):
 	- if you change, add, or remove a command line option or
 	  make some other user interface change, the associated
 	  documentation should be updated as well.
+	- if your name is not writable in ASCII, make sure that 
+	  you send off a message in the correct encoding.
 
 Long version:
 
Signature · 1 line
1.5.2.2663.gd77e7-dirty