请问:sapop3读出来的邮件为乱码,该如何解决呢??

letian 2002-12-03 05:13:34
The same
...全文
67 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
letian 2002-12-04
  • 打赏
  • 举报
回复
具体得如何改呢??
letian 2002-12-04
  • 打赏
  • 举报
回复
可能跟以下函数有关,不知得如何改?

private void GetEncoding()
{
int begin, end;
begin = end = 0;

try
{
if((begin = m_strLowHeader.IndexOf("content-transfer-encoding: ")) < 0)
throw new POP3ParseException("could not find Encoding tag");
if((end = m_strHeader.Substring(begin).IndexOf("\r\n")) < 0)
throw new POP3ParseException("could not find end of Encoding tag");

end += begin;
begin += 27;
m_strEncoding = m_strHeader.Substring(begin, end - begin).ToLower();

}
catch(POP3ParseException e)
{
m_pSAPOP3.TRACE(e.ToString());
if(m_pSAPOP3.Log)
{
string strErr = "SAPOP3Message::GetUID()";
strErr += e.Message;
m_pSAPOP3.TRACE(strErr);
}
}
catch(Exception e)
{
m_pSAPOP3.TRACE(e.ToString());
if(m_pSAPOP3.Log)
{
string strErr = "SAPOP3Message::GetUID()";
strErr += e.Message;
m_pSAPOP3.LogError(strErr);
}
}

}
protected void GetCharSet()
{
int begin, end;
begin = end = 0;
try
{
// parse buffer
if((begin = m_strLowHeader.IndexOf("charset=")) < 0)
throw new POP3ParseException ("GetCharSet could not find beginning of 'charset' tag");
if((end = m_strHeader.Substring(begin + 2).IndexOf("\"")) < 0)
throw new POP3ParseException ("GetCharSet could not find end of 'charset' tag");

// make temporary string of charset tag
string strContType = m_strHeader.Substring(begin);

// parse mime version
if((begin = strContType.IndexOf("\"")) < 0)
throw new POP3ParseException ("GetCharSet could not find leading ' '");
if((end = strContType.LastIndexOf("\"")) < 0)
throw new POP3ParseException("GetCharSet could not fine end of tag");


m_strCharset = strContType.Substring(++begin, end - begin).ToLower();
}
catch(POP3ParseException e)
{
m_pSAPOP3.TRACE(e.ToString());
if(m_pSAPOP3.Log)
{
string strErr = "SAPOP3Message::GetUID()";
strErr += e.Message;
m_pSAPOP3.TRACE(strErr);
}
}
catch(Exception e)
{
m_pSAPOP3.TRACE(e.ToString());
if(m_pSAPOP3.Log)
{
string strErr = "SAPOP3Message::GetUID()";
strErr += e.Message;
m_pSAPOP3.LogError(strErr);
}
}

}
孟子E章 2002-12-03
  • 打赏
  • 举报
回复
都用utf-8进行编码和显示

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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