在base64编码的电子邮件中


� in base64 encoded emails

我用瑞典语+ MS Outlook有问题。

这一切都工作得很好,除了MS Outlook。在Outlook中,瑞典字符显示为"。"电子邮件内容是base64编码,uft-8等。会出什么问题呢?

附录:

消息如下:

============================================================  
Header 
============================================================ 
*** NY Beställning *** 
Ni har fått ny beställning från: FirstAccount 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
Beställnings-ID: FA12914-1  
Beställningsdetaljer: http://somelink
Beställningsdatum: 11/14/2011 11:16  
Önskat leveransdatum:   
Ordersedel: http://somlink 
Original: <http://somelink> 
Product: New stuff 
Product ID:   
Description:  
Qty: 11 
Job type: Release from stock
Kommenar:  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________________________ 
Copyright (c) 2011 Someone

来源:

Return-path: <test@example.com>
Envelope-to: admin@example.com
Delivery-date: Mon, 14 Nov 2011 11:17:00 +0000
Received: from somewhere ([123.456.789.012])
        by someone.co.uk with esmtp (Exim 4.69)
        (envelope-from <test@example.com>)
        id 1RPuX1-0006sU-HG
        for admin@example.com; Mon, 14 Nov 2011 11:16:58 +0000
Received: by someone.co.ul (Postfix, from userid 33)
        id B743C4EB7F; Mon, 14 Nov 2011 11:16:52 +0000 (UTC)
To: "Admin" <admin@example.com>
Subject: Ny beställning har kommit in från ace Beställnings-ID: FA12914-1
From: test@example.com
X-Mailer: Html Mime Mail Class
MIME-Version: 1.0
Content-Type: multipart/mixed;
   boundary="=_41bea315b9b2f2301a97632f8d6c3057"
Message-Id: <20111114111652.B743C4EB7F@li214-208.members.linode.com>
Date: Mon, 14 Nov 2011 11:16:52 +0000 (UTC)
X-Spam-Status: No, score=1.4
X-Spam-Score: 14
X-Spam-Bar: +
X-Ham-Report: Spam detection software, running on the system "somewhere", has
   identified this incoming email as possible spam.  The original message
   has been attached to this so you can view it (if it isn't spam) or label
   similar future email.  If you have any questions, see
   the administrator of that system for details.
X-Spam-Flag: NO

This is a MIME encoded message.
--=_41bea315b9b2f2301a97632f8d6c3057
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09IA0KYWNlIA0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09IA0KICAgICAgICAgICAgICAgIA0KKioqIE5ZIEJlc3TDpGxsbmluZyAq
KiogDQ........
--=_41bea315b9b2f2301a97632f8d6c3057--

粘贴的消息源在Content-Type: header中间似乎有一个虚假的换行符。它应该是一个单一的逻辑行;虽然也许你粘贴错了(至少Received:报头没有被正确粘贴)。类似的事情似乎也发生在base64主体部分——我们看到数据行之间的空行。

它看起来像这样:

Content-Type: multipart/mixed;
boundary="=_41bea315b9b2f2301a97632f8d6c3057"

应该是:

Content-Type: multipart/mixed;
   boundary="=_41bea315b9b2f2301a97632f8d6c3057"

在"boundary"关键字前至少有一个空白字符;甚至

Content-Type: multipart/mixed; boundary="=_41bea315b9b2f2301a97632f8d6c3057"

此外,如果主题行包含8位数据,您应该对其进行rfc2047编码。

Subject: =?utf-8?Q?Ny_best=C3=A4llning_har_kommit_in_fr=C3=A5n_ace_Best=C3=A4llnings-ID:_FA12914-1?=

删除换行符后,body部分的base64数据看起来是正确的,即单词"Beställning"显示正确(尽管它不应该正确大小写;也许会有一个Swedish.stackexchange.com来评论你的文章?: -)

X-Mailer:标头表明您正在使用一个软件生成这些消息;它可能有正确处理这些事情的选项,但您没有使用它们。这是一个编程论坛,所以你应该向我们展示你的代码,并用适当的编程语言标记问题。