我晕。。~~一个问题发了两遍了,,居然没有人能答得上来,,~~~~~~~~!!!!!!!!!!!!!!!!

cbpfy 2005-06-01 11:28:12
小弟作了个邮件解析程序,,需要把邮件各个部分 编码解码,,,现在就是邮件里的 7bit 编码 不知道如何解码了,,请问如何解码阿,,很着急。!!
开发工具 vc++6.0
环境win2000
...全文
272 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
cbpfy 2005-06-21
  • 打赏
  • 举报
回复
luoxiangdong(快乐的2004) ?????????????
QP的编结码 的函数 还有base64 的编结码函数 我都写过了
就差 7bit的了。。谢谢
luoxiangdong 2005-06-15
  • 打赏
  • 举报
回复
看错了
luoxiangdong 2005-06-15
  • 打赏
  • 举报
回复
CString CQuotedPrintable::Encode(LPCTSTR pSrc, int nSrcLen)
{
CString sOutput = _T( "" );

int nMaxLineLen=76;
char buf[100];
char* pDst=buf;

memset(pDst,0,100);


int nDstLen; // 输出的字符计数
int nLineLen; // 输出的行长度计数

nDstLen = 0;
nLineLen = 0;

for (int i = 0; i < nSrcLen; i++, pSrc++)
{
// ASCII 33-60, 62-126原样输出,其余的需编码
if ((*pSrc >= '!') && (*pSrc <= '~') && (*pSrc != '='))
{
*pDst++ = (char)*pSrc;
nDstLen++;
nLineLen++;
}
else
{
sprintf(pDst, "=%02X", *pSrc);
pDst += 3;
nDstLen += 3;
nLineLen += 3;
}

// 输出换行?
if (nLineLen >= nMaxLineLen - 3)
{
sprintf(pDst, "=\r\n");
pDst += 3;
nDstLen += 3;
nLineLen = 0;
}
}

// 输出加个结束符
*pDst = '\0';

sOutput=pDst;
return sOutput;

}

// The size of the output buffer must not be less than
// 3/4 the size of the input buffer. For simplicity,
// make them the same size.
int CQuotedPrintable::Decode(LPCTSTR pSrc, LPTSTR pDst)
{

int nSrcLen;
nSrcLen=strlen(pSrc);

int nDstLen; // 输出的字符计数
int i;

i = 0;
nDstLen = 0;

while (i < nSrcLen)
{
if (strncmp(pSrc, "=\r\n", 3) == 0) // 软回车,跳过
{
pSrc += 3;
i += 3;
}
else
{
if (*pSrc == '=') // 是编码字节
{
sscanf(pSrc, "=%02X", pDst);
pDst++;
pSrc += 3;
i += 3;
}
else // 非编码字节
{
*pDst++ = (unsigned char)*pSrc++;
i++;
}

nDstLen++;
}
}

// 输出加个结束符
*pDst = '\0';

return nDstLen;



}
cbpfy 2005-06-06
  • 打赏
  • 举报
回复
嗯,,,有没有源码啊,,,???
很着急用。。。
谢谢了
Hendy_So 2005-06-03
  • 打赏
  • 举报
回复
RFC1642
  • 打赏
  • 举报
回复
http://www.mailer.com.cn/article/archive/195/
这里有各种邮件编码的格式,楼主自己看看吧。
cbpfy 2005-06-02
  • 打赏
  • 举报
回复
嗯,,base64 和QP 解码都已经解决
cbpfy 2005-06-02
  • 打赏
  • 举报
回复
嗯,,其实就是 utf-7 的解码函数,,用c语言实现的过程,,
那位高人能否 指点一下。。谢谢了,,
例如就是这种情况
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-7"

+IBxOcXgBWSdRaCAd/wxPXIAF/xo-bluesea+/wxsNGcobgVTTg-
BBS+YhBUWDACayKPzlco- BBS+Ti2PbI99MAJnLGWHU5+PfU6ObDRnKA-
+bgVTTg- BBS +doQ- Internet+i6iLulM6MAI-

用函数 实现解码过程。。。。
cbpfy 2005-06-02
  • 打赏
  • 举报
回复
嗯, 我用的是vc6
希望得到帮助,,,谢谢。。
dongfa 2005-06-02
  • 打赏
  • 举报
回复
如果使用.net就容易多了
里面自带 UTF7的编码和解码.

UTF7Encoding class
Hendy_So 2005-06-01
  • 打赏
  • 举报
回复
http://www.mailer.com.cn/article/archive/195
seanbcliu 2005-06-01
  • 打赏
  • 举报
回复
說的不詳細, 你是用Base64編碼解碼嗎?

2,586

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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