From: Sven Verdoolaege Date: Wed, 11 Jul 2007 08:42:32 GMT Subject: Re: [PATCH] send-email: extend sanitize_address_rfc822 to do rfc2047 quoting Message-ID: <20070711084232.GE1528MdfPADPa@greensroom.kotnet.org> In-Reply-To: <11840869641759-git-send-email-ukleinek@informatik.uni-freiburg.de> On Tue, Jul 10, 2007 at 07:02:43PM +0200, Uwe Kleine-König wrote: > my ($recipient) = @_; > - my ($recipient_name) = ($recipient =~ /^(.*?)\s+ + my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)(\s+<.*)/); > + > + if ($recipient_name && $recipient_name =~ /[^-a-zA-Z0-9!*+\/ ]/ && $recipient_name !~ /=\?utf-8\?q?.*\?=/) { Why the extra test for truthness of $recipient_name ? > if ($recipient_name && $recipient_name =~ /\./ && $recipient_name !~ /^".*"$/) { > - my ($name, $addr) = ($recipient =~ /^(.*?)(\s+<.*)/); > - $recipient = "\"$name\"$addr"; > + $recipient_name = "\"$recipient_name\""; > + } > + > + if ($recipient_name) { > + return "$recipient_name$recipient_addr"; > + } else { > + return "$recipient"; > } > - return $recipient; Why did you introduce interpolation just to get $recipient again? Then again, why do you need a test at all here? return $recipient_name . $recipient_addr; should work, no? skimo