From patchwork Tue May 7 21:50:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 242469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 298282C019E for ; Wed, 8 May 2013 07:49:41 +1000 (EST) Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8EDBB2C0158 for ; Wed, 8 May 2013 07:49:38 +1000 (EST) Received: by mail-ee0-f48.google.com with SMTP id c4so69814eek.21 for ; Tue, 07 May 2013 14:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=qbe9bzUQx1+ValjaOS+4g+3rGrUor8mEOd/MviWX7Dk=; b=jYhqzgTrDSP+T9aHwsO4yhrqJ8trxC7AfwnY+W1DuBGJ6gPxlpG6skyUxFHMVqTsee Q4agklYEh+srL5HGMGxFmbWUU6POY9dE4wrUMJ0ZX9xeKCFjvF7qEVhYYQTjIAddaRmH QzZ29gSx9MQGyCZkvZF7kQq/hxvxcTY+EFlrE8/CuXIRzGysrzaWKI1nCVCS+Yr0vwZ2 r4vU3Q6IZbVCfYUmLfKedAp7294UybTSEy4Bbd1WW07K0e3tsVkyLVmzoPn7l9IDQ3kf /IHf5D6oh+t2FhevIcpZySsxogBHR0+hG+uiXe2fzPikOsWJPM68fb11VF0k4MtqDWWU pH8g== X-Received: by 10.15.33.195 with SMTP id c43mr9842339eev.2.1367963374450; Tue, 07 May 2013 14:49:34 -0700 (PDT) Received: from andreas-mbp.er.biessmann.org (er.biessmann.org. [80.81.14.92]) by mx.google.com with ESMTPSA id bp51sm39859414eeb.5.2013.05.07.14.49.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 14:49:33 -0700 (PDT) Message-ID: <5189772B.3050704@googlemail.com> Date: Tue, 07 May 2013 23:50:35 +0200 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Scott Wood Subject: Re: [U-Boot] [U-Boot,1/3] nand: Clean up nand_util References: <1353091119.13910.3@snotra> <50A79858.6060403@googlemail.com> In-Reply-To: <50A79858.6060403@googlemail.com> Cc: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Hi all, On 17.11.12 14:59, Andreas Bießmann wrote: > Dear Scott Wood, > > On 16.11.12 19:38, Scott Wood wrote: >> On 11/16/2012 01:43:24 AM, Andreas Bießmann wrote: >>> Dear Scott Wood, >>> >>> On 16.11.12 08:20, Andreas Bießmann wrote: >>>> Dear Scott Wood, >>>> >>>> On 16.11.12 01:29, Scott Wood wrote: >>>>> On 11/15/2012 06:22:11 PM, Scott Wood wrote: >>>>>> On Mon, Nov 05, 2012 at 10:15:46AM -0000, >>>>>> >>> =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau_=3Cbenoit=2Ethebaudeau=40advans?==?utf-8?q?ee=2Ecom=3E?= >>> >>>>>> wrote: >>>>> >>>>> Sigh, it looks like either patchwork is mangling the From address or >>>>> mutt is failing to understand something valid (I assume the latter >>> since >>>>> "git am" didn't seem to have a problem with it)... I don't see this >>>>> encoding in the original e-mail. as I understood RFC 2822 3.4 the From header should contain the '<' and '>' as described in the 'angle-addr' spec. There are some exceptions but this is the default. The domain and user parts of the address however must consist of 'quoted-string' which is US-ASCII without some special chars. Therefore patchwork is false here due to wrongly coding the address. >>>> patchwork has no influence her. AFAIK the mail header should only >>>> contain ASCII, >> >> This is how I got it in the original e-mail: >> >> From: =?iso-8859-1?q?Beno=EEt_Th=E9baudeau?= >> \t >> >> I found another e-mail on the U-Boot list where it did arrive encoded, >> and both Balsa (which also fails on the Patchwork-produced mbox) and >> mutt decode it fine. >> >> Another example straight from the list that both decode fine is: >> From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= >> >> >> From Patchwork it becomes: >> From: >> =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau_=3Cbenoit=2Ethebaudeau=40advans?= >> =?utf-8?q?ee=2Ecom=3E?= >> >> So patchwork is re-encoding these into UTF-8 (if it was originally >> something else) and encoding the entire address, not just the comment >> section. > > You are right. I did only investigate the mails on list, but patchwork > must re-encode the header here. I had some time to dive into this and found the root cause of the re-coded From header. > I checked for example http://patchwork.ozlabs.org/patch/199686/. If you > show the header on webpage you will find the unchanged 'From:' as on the > list. But if you get the mbox via > http://patchwork.ozlabs.org/patch/199686/mbox/ the 'From:' is recoded. Patchwork recodes the 'From' header of the mail in the Patch model. The following snippet might fix it, unfortunately I have no clue how to verify it really works without installing the whole thing: ---8<--- --->8--- Maybe the Person model should be expanded by some method to provide a correctly formatted Header() for the 'From' field? Best regards Andreas Bießmann diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index 9129aab..606ffe0 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -281,7 +281,9 @@ class Patch(models.Model): mail['Subject'] = self.name mail['Date'] = email.utils.formatdate( time.mktime(self.date.utctimetuple())) - mail['From'] = unicode(self.submitter) + mail['From'] = email.utils.formataddr( + str(Header(self.submitter.name, 'utf-8')), + self.submitter.email) mail['X-Patchwork-Id'] = str(self.id) mail['Message-Id'] = self.msgid mail.set_unixfrom('From patchwork ' + self.date.ctime())