{"thread":{"id":"20524","subject":"[PATCH 0/2] Fix cover letters when they contain non-ASCII","startedAt":"2009-08-10T16:22:12Z","lastAt":"2009-08-10T16:22:22Z","messageCount":3,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"120185","messageId":"cover.1249921206u.git.johannes.schindelin@gmx.de","threadId":"20524","inReplyTo":null,"subject":"[PATCH 0/2] Fix cover letters when they contain non-ASCII","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-10T16:22:12Z","receivedAt":"2009-08-10T16:22:12Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nI saw this issue with Santi's and Nguy�n's patch series.\n\nJohannes Schindelin (2):\n  Expose the has_non_ascii() function\n  Correctly mark cover letters' encodings if they are not pure ASCII\n\n builtin-log.c |    4 ++++\n commit.h      |    1 +\n log-tree.c    |   12 ------------\n pretty.c      |   12 ++++++++++++\n 4 files changed, 17 insertions(+), 12 deletions(-)"},{"id":"120187","messageId":"7388ff3756d6a431fc9a640a4fa02a70d1e54106.1249921206u.git.johannes.schindelin@gmx.de","threadId":"20524","inReplyTo":"cover.1249921206u.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/2] Expose the has_non_ascii() function","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-10T16:22:18Z","receivedAt":"2009-08-10T16:22:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This function is useful outside of log-tree.c, too.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n commit.h   |    1 +\n log-tree.c |   12 ------------\n pretty.c   |   12 ++++++++++++\n 3 files changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/commit.h b/commit.h\nindex 8bfdf0e..d1674d7 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -64,6 +64,7 @@ enum cmit_fmt {\n };\n \n extern int non_ascii(int);\n+extern int has_non_ascii(const char *text);\n struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n extern char *reencode_commit_message(const struct commit *commit,\n \t\t\t\t     const char **encoding_p);\ndiff --git a/log-tree.c b/log-tree.c\nindex 6f73c17..a3b4c06 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -168,18 +168,6 @@ static unsigned int digits_in_number(unsigned int number)\n \treturn result;\n }\n \n-static int has_non_ascii(const char *s)\n-{\n-\tint ch;\n-\tif (!s)\n-\t\treturn 0;\n-\twhile ((ch = *s++) != '\\0') {\n-\t\tif (non_ascii(ch))\n-\t\t\treturn 1;\n-\t}\n-\treturn 0;\n-}\n-\n void get_patch_filename(struct commit *commit, int nr, const char *suffix,\n \t\t\tstruct strbuf *buf)\n {\ndiff --git a/pretty.c b/pretty.c\nindex 1aa9c3f..ec0affe 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -86,6 +86,18 @@ int non_ascii(int ch)\n \treturn !isascii(ch) || ch == '\\033';\n }\n \n+int has_non_ascii(const char *s)\n+{\n+\tint ch;\n+\tif (!s)\n+\t\treturn 0;\n+\twhile ((ch = *s++) != '\\0') {\n+\t\tif (non_ascii(ch))\n+\t\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n static int is_rfc2047_special(char ch)\n {\n \treturn (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));\n-- \n1.6.3.2.734.g770e\n"},{"id":"120186","messageId":"c3c2969ae2c3b358542a466f52ea147f0275eccd.1249921206u.git.johannes.schindelin@gmx.de","threadId":"20524","inReplyTo":"cover.1249921206u.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-10T16:22:22Z","receivedAt":"2009-08-10T16:22:22Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"If your name is, say, Üwë, you want your cover letters to appear\ncorrectly.  Convince format-patch to mark it as 8-bit.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin-log.c |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 3600215..d4a6a7d 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -678,6 +678,10 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,\n \tlog_write_email_headers(rev, head, &subject_start, &extra_headers,\n \t\t\t\t&need_8bit_cte);\n \n+\tfor (i = 0; !need_8bit_cte && i < nr; i++)\n+\t\tif (has_non_ascii(list[i]->buffer))\n+\t\t\tneed_8bit_cte = 1;\n+\n \tmsg = body;\n \tpp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822,\n \t\t     encoding);\n-- \n1.6.3.2.734.g770e"}]}