新手求助一个收jmail邮件附件名解码的问题!

cdminer 2012-07-06 02:57:22
用jmail收邮件,附件名是
filename="=?UTF-8?Q?=E7=9B=98=E5=B1=B1=E5=AE=9E=E6=99=AF?=
=?UTF-8?Q?=E6=BC=94=E5=87=BA=E9=A1=B9=E7=9B=AE=E5=9B=BD?=
=?UTF-8?Q?=E6=9C=89=E6=94=B6=E5=9B=9E80.dwg?=" 如何解码? 谢谢!
...全文
115 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cdminer 2012-07-10
  • 打赏
  • 举报
回复
你说的QP解码程序我知道,用这个解完是乱码,我的这个邮件是139邮箱发来的,只有这个邮箱发来的附件解不了。

------=_Part_178291_710098754.1341883618288
Content-Type: application/x-dwg;name==?UTF-8?Q?=E5=90=95=E7=A6=8F=E5=88=A9.dwg?=
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="=?UTF-8?Q?=E5=90=95=E7=A6=8F=E5=88=A9.dwg?="

这是他的附件名,用Qp解不了。
wl076 2012-07-06
  • 打赏
  • 举报
回复

#region quoted-printable解码
private string QPUnEncryCode(string source)
{
source=source.Replace ("=\r\n","");
int len=source.Length ;
string dest=string.Empty ;
int i=0;
while(i<len)
{
string temp=source.Substring (i,1);
if(temp=="=")
{
int code=Convert.ToInt32 (source.Substring (i+1,2),16);
if(Convert.ToInt32 (code.ToString (),10)<127)
{
dest+=((char)code).ToString ();
i=i+3;
}
else
{
dest+=System.Text.Encoding.Default.GetString(new byte []{Convert.ToByte (source.Substring (i+1,2),16),Convert.ToByte (source.Substring (i+4,2),16)}) ;
i=i+6;
}
}
else
{
dest+=temp;
i++;
}
}
return dest;
}

#endregion

wl076 2012-07-06
  • 打赏
  • 举报
回复
是QP编码

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧