社区
C#
帖子详情
请各位发个邮件中quoted printable的编码函数,c#的,不要解码,只要编码的~
liuguozhong
2007-03-20 08:49:52
如题,谢谢了~
...全文
249
9
打赏
收藏
请各位发个邮件中quoted printable的编码函数,c#的,不要解码,只要编码的~
如题,谢谢了~
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
王集鹄
2007-03-20
打赏
举报
回复
//硬写一个也不难...
using System.Collections;
using System.Globalization;
public string QuotedPrintableEncode(string AText) // QP编码
{
string Result = "";
byte[] vBuffer = Encoding.Default.GetBytes(AText);
foreach(byte vByte in vBuffer)
// 可见字符并非"="(#61)
if ((vByte >= 33 && vByte <= 60) || (vByte >= 62 && vByte <= 126))
Result += (char)vByte;
else Result += "=" + vByte.ToString("X2");
return Result;
}
public static string QuotedPrintableDecode(string ACode) // 解码
{
ArrayList vBuffer = new ArrayList();
for(int i = 0; i < ACode.Length; i++)
{
if (ACode[i] == '=')
{
i++;
if (ACode[i] != '\r')
{
byte vByte;
if (byte.TryParse(ACode.Substring(i, 2),
NumberStyles.HexNumber, null, out vByte))
vBuffer.Add(vByte);
}
i++;
}
else if (ACode[i] != '\n') vBuffer.Add((byte)ACode[i]);
}
return Encoding.Default.GetString((byte[])vBuffer.ToArray(typeof(byte)));
}
private void button1_Click(object sender, EventArgs e)
{
Text = QuotedPrintableDecode(QuotedPrintableEncode("zswang 路过"));
}
liuguozhong
2007-03-20
打赏
举报
回复
zswang(伴水清清)(专家门诊清洁工) :
先谢过,可是我要字符串转化为qp编码呢~
王集鹄
2007-03-20
打赏
举报
回复
附件里可以指定编码方式,参考:
Attachment vAttachment = new Attachment("yourfile");
vAttachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;
liuguozhong
2007-03-20
打赏
举报
回复
50分没人要啊~
richard530
2007-03-20
打赏
举报
回复
up~
liuguozhong
2007-03-20
打赏
举报
回复
再顶一下,怎么没有人帮忙呀~
liuguozhong
2007-03-20
打赏
举报
回复
人工置顶~
liuguozhong
2007-03-20
打赏
举报
回复
顶一下,谢谢了~
liuguozhong
2007-03-20
打赏
举报
回复
感谢~
Quote
d-
pr
int
able
编码
介绍、
Quote
d-
pr
int
able
编码
解码
转换方法
主要介绍了
Quote
d-
pr
int
able
编码
介绍、
Quote
d-
pr
int
able
编码
解码
转换方法,需要的朋友可以参考下
C#
邮件
发送接收+
邮件
内容
解码
包含smtp
邮件
发送,pop
邮件
接收,
邮件
内容
解码
,内涵多种
解码
正则表达式 源码
C#
邮件
接收案例源码.rar.rar
C#
邮件
接收案例源码.rar.rar
邮件
MIME的解析
邮件
MIME的解析示范
elm.txt
eml.txt:just all cs files
C#
111,097
社区成员
642,554
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章