From: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>
To: git@vger.kernel.org
Cc: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>
Subject: [PATCH] send-email: let sanitize_address_rfc822 do rfc2047 quoting
Date: Sun, 5 Aug 2007 22:09:08 +0200 [thread overview]
Message-ID: <11863445481996-git-send-email-ukleinek@informatik.uni-freiburg.de> (raw)
Without this patch I'm not able to properly send emails as I have a
non-ascii character in my name.
The former version tried to fix-up the real name part with double quotes
if it includes a '.'. I removed this as rfc2047 can handle a dot, too.
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
Hello,
I already sent a similar patch that was discussed a bit[1], but was not taken.
The list of allowed character was taken from Python's email package.
Comparing with the former version I removed the quoting as described in
the 2nd paragraph of the log and now I only test $recipient_name once.
I will try to send this patch with next + this patch. I think it should
work in principle, but --suppress-from is not honored. I will take a
look on this issue later.
Best regards
Uwe
[1] http://thread.gmane.org/gmane.comp.version-control.git/52093
git-send-email.perl | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index f43f92f..5785e29 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -459,16 +459,27 @@ sub unquote_rfc2047 {
return "$_";
}
-# If an address contains a . in the name portion, the name must be quoted.
+# The name part of an address must consist only of alnum chars, space and a few
+# others.
+# If it contains a "forbidden" char in the name port, quote it according to
+# rfc2047.
sub sanitize_address_rfc822
{
my ($recipient) = @_;
- my ($recipient_name) = ($recipient =~ /^(.*?)\s+</);
- if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) {
- my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
- $recipient = "\"$name\"$addr";
+ my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)(\s+<.*)/);
+
+ if ($recipient_name) {
+ if ($recipient_name =~ /[^-a-zA-Z0-9!*+\/ ]/ && $recipient_name !~ /=\?utf-8\?q?.*\?=/) {
+ $recipient_name =~ s/([^-a-zA-Z0-9!*+\/ ])/sprintf("=%02X", ord($1))/eg;
+ $recipient_name =~ s/ /_/;
+ $recipient_name =~ s/(.*)/=\?utf-8\?q\?$1\?=/;
+ }
+
+ return "$recipient_name$recipient_addr";
+
+ } else {
+ return "$recipient";
}
- return $recipient;
}
sub send_message
--
1.5.3.rc3.13.g7ab3
next reply other threads:[~2007-08-05 20:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-05 20:09 Uwe Kleine-König [this message]
2007-08-06 0:21 ` [PATCH] send-email: let sanitize_address_rfc822 do rfc2047 quoting Jakub Narebski
2007-08-06 8:33 ` Uwe Kleine-König
2007-08-06 20:34 ` [PATCH] send-email: teach sanitize_address to " Uwe Kleine-König
2007-08-09 12:10 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11863445481996-git-send-email-ukleinek@informatik.uni-freiburg.de \
--to=ukleinek@informatik.uni-freiburg.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).