delphi xe7 update1+indy10.6收邮件,有一种邮件标题和正文含有汉字就乱码。将IdMessage1的NoDecode := True;和NoEncode := True;保存为.eml文件,用Foxmail打开正文则汉字显示正常。
用自带的base64解码函数DecodeString(IdMessage1.Body.Text);则报错:
.eml文件部分内容如下:
Subject: ??????????????360??????????????????????????????????
X-PHP-Originating-Script: 1017:func.php
MIME-Version: 1.0rn
Content-type: text/html
From: 360???????????? <[email protected]>
Content-Transfer-Encoding: base64
X-MIME-Autoconverted: from 8bit to base64 by se4.white.zwt.qihoo.net id t5H7Xtwt015350PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlv
bmFsLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXRyYW5z
aXRpb25hbC5kdGQiPg0KPGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0
bWwiPg0KPGhlYWQ+DQo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9
InRleHQvaHRtbDsgY2hhcnNldD1HQjIzMTIiIC8+DQo8dGl0bGU+zt6x6szizsS1tTwvdGl0
bGU+DQo8c3R5bGU+DQoqe21hcmdpbjowcHg7cGFkZGluZzowcHg7Zm9udC1zaXplOjEycHg7
IGxpbmUtaGVpZ2h0OjEuODsgZm9udC1mYW1pbHk6QXJpYWw7fQ0KYXtjb2xvcjojMDA2N2I2
O3RleHQtZGVjb3JhdGlvbjpub25lfQ0KYTpob3Zlcnt0ZXh0LWRlY29yYXRpb246bm9uZTt9
DQo8L3N0eWxlPg0KPC9oZWFkPg0KDQo8Ym9keT4NCjx0YWJsZSB3aWR0aD0iNjg2IiBhbGln
bj0iY2VudGVyIiBjZWxsc3BhY2luZz0iMTAiIHN0eWxlPSJib3JkZXItYm90dG9tOjFweCBz
b2xpZCAjY2NjOyIgYmdjb2xvcj0iI0ZGRkZGRiI+DQog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kPg0KICAgIDx0
ZCBhbGlnbj0icmlnaHQiPjM2MMjtvP6/qrfFxr3MqDxiciAvPg0KICAgIDIwMTXE6jA21MIx
N8jVPC90ZD4NCiAgPC90cj4NCjwvdGFibGU+DQo8L2JvZHk+DQo8L2h0bWw+DQoNCg==

解决方案 »

  1.   

    Subject: ??????????????360??????????????????????????????????这块应该不是这样的吧?原始邮件的内容是什么?
      

  2.   

    先不管标题,保存的eml文件正文Foxmail打开能显示正常,说明正文部分接收是对的,现在关心的Delphi xe7怎样把它完整显示出来。
      

  3.   

    这个base64应该不是标准的base64算法那么简单,肯定还有别的算法
    直接解码确实解析不出来