修改MIME_b_Text.cs文件,红色字体为添加的部分,绿色为修改部分

private static Encoding m_pEncoding = Encoding.Default;

#region static method Parse

/// <summary>
/// Parses body from the specified stream
/// </summary>
/// <param name="owner">Owner MIME entity.</param>
/// <param name="defaultContentType">Default content-type for this body.</param>
/// <param name="stream">Stream from where to read body.</param>
/// <returns>Returns parsed body.</returns>
/// <exception cref="ArgumentNullException">Is raised when <b>stream</b>, <b>mediaType</b> or <b>stream</b> is null reference.</exception>
/// <exception cref="ParseException">Is raised when any parsing errors.</exception>
protected static new MIME_b Parse(MIME_Entity owner,MIME_h_ContentType defaultContentType,SmartStream stream)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(defaultContentType == null){
throw new ArgumentNullException("defaultContentType");
}
if(stream == null){
throw new ArgumentNullException("stream");
}

MIME_b_Text retVal = null;
if(owner.ContentType != null){
retVal = new MIME_b_Text(owner.ContentType.TypeWithSubtype);
}
else{
retVal = new MIME_b_Text(defaultContentType.TypeWithSubtype);
}

Net_Utils.StreamCopy(stream,retVal.EncodedStream,32000);

m_pEncoding = stream.Encoding;

retVal.SetModified(false);

return retVal;
}

#endregion

#region method GetCharset

/// <summary>
/// Gets charset from Content-Type. If char set isn't specified, "ascii" is defined as default and it will be returned.
/// </summary>
/// <returns>Returns content charset.</returns>
/// <exception cref="ArgumentException">Is raised when Content-Type has not supported charset parameter value.</exception>
private Encoding GetCharset()
{
// RFC 2046 4.1.2. The default character set, US-ASCII.

if(this.Entity.ContentType == null || string.IsNullOrEmpty(this.Entity.ContentType.Param_Charset)){
//return Encoding.ASCII;
return m_pEncoding;
}
else{
// Handle custome/extended charsets, just remove "x-" from start.
if(this.Entity.ContentType.Param_Charset.ToLower().StartsWith("x-")){
return Encoding.GetEncoding(this.Entity.ContentType.Param_Charset.Substring(2));
}
// Cp1252 is not IANA reggistered, some mail clients send it, it equal to windows-1252.
else if(string.Equals(this.Entity.ContentType.Param_Charset,"cp1252",StringComparison.InvariantCultureIgnoreCase)){
return Encoding.GetEncoding("windows-1252");
}
else{
return Encoding.GetEncoding(this.Entity.ContentType.Param_Charset);
}
}
}

#endregion

lumisoft邮件内容中文乱码问题的更多相关文章

  1. 解决gitk显示文件内容中文乱码

    解决gitk显示文件内容中文乱码 1.git config 命令 设置git gui的界面编码 git config --global gui.encoding utf-8 2.修改配置文件 在~\e ...

  2. phpstudy 首次安装后打开网站 数据库内容 中文乱码

    首次安装完成 phpstudy 后,默认的 my.ini 配置只有数据库文件位置,其他的都没有设置,这时如果想要输出数据库中的中文后,显示到页面上就会变成中文乱码 解决方法: 打开 phpstudy ...

  3. poi excel文件名或者内容中文乱码

    1.文件名乱码处理 // excel文件名 String fileName="我报表"; final SimpleDateFormat formatter = new Simple ...

  4. zabbix邮件内容乱码与邮件内容为附件解决办法

    在zabbix的实际使用过程中,在收到邮件预警的时候,我们会发现邮件内容是乱码的,在手机端收到的是附件,而且附件下载后的文件类型是打不开的.这样我们不知道我们是哪个服务器的哪项服务出了问题,接下来我们 ...

  5. php 使用phpmailer 发送邮件(附带中文乱码的解决方法)

    下载phpmailer ,在程序里包含class.phpmailer.php 类  ,这里有中文乱码的解决方法 实例代码如下 <html> <head> <title&g ...

  6. C# MailMessage Attachment 中文名附件发邮件-Firefox中文显示正常,网页打开邮件附件中文名乱码

    一.故事 首先通过CDO.Message来获取邮件EML相关数据:邮件标题.邮件内容.邮件附件.发件人.收件人.CC主要就这么几个,其次通过MailMessage来组织邮件通过Python来发送邮件! ...

  7. 用c#读取文件内容中文是乱码的解决方法:

    用c#读取文件内容中文是乱码的解决方法: //方法1: StreamReader din = new StreamReader(@"C:\1.txt", System.Text.E ...

  8. node.js学习4--------------------- 根据不同路径来响应内容,以及中文乱码的解决

    /** * http服务器的搭建,相当于php中的Apache或者java中的tomcat服务器 */ // 导包 const http=require("http"); //创建 ...

  9. windows平台下编辑的内容传到linux平台出现中文乱码的解决办法

    现象说明:在windows下编辑的内容,上传到linux平台下出现中文乱码.如下: 在windows平台编写haha.txt文件,内容如下: 上传到linux平台,出现中文乱码,如下: 基本上面出现的 ...

随机推荐

  1. JMeter 中 HTTP Cookie 管理器的使用

    根据 web 应用的复杂度你可以选择创建两种类型的 JMeter 测试计划:面向点击数的或面向场景的. 创建一个面向点击数的测试计划你需要有中值统计.这些统计要包含你的应用每秒应该处理多少个独立请求的 ...

  2. IO复用之epoll系列

    epoll是什么? epoll是Linux内核为处理大批量文件描述符而作了改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著提高程序在大量并发连接中只有少量活跃的 ...

  3. thinkphp的where方法的使用

    1.Thinkphp中where()条件的使用 总是有人觉得,thinkphp的where()就是写我要进行增加.查询.修改.删除数据的条件,很简单的,其实我想告诉你,where()是写条件语句的,但 ...

  4. 洛谷P3620 [APIO/CTSC 2007] 数据备份 [堆,贪心,差分]

    题目传送门 题目描述 你在一家 IT 公司为大型写字楼或办公楼(offices)的计算机数据做备份.然而数据备份的工作是枯燥乏味的,因此你想设计一个系统让不同的办公楼彼此之间互相备份,而你则坐在家中尽 ...

  5. 读书笔记(高性能javascript)(二)

    5. 字符串和正则表达式: (1) 在大多数浏览器中,数组项合并(Array.prototype.join)比其他字符串连接方法更慢,但它却在IE7及更早版本浏览器中合并大量字符串唯一高效的途径: ( ...

  6. Web开发中的路径问题总结

    原文地址:http://zzqrj.iteye.com/blog/806909 路径问题在Web开发中算是令人比较蛋疼的问题,尤其是用相对地址时,同样的代码,在不同的目录结构中竟然会出现有对有错的结果 ...

  7. 插头dp练习

    最近学了插头dp,准备陆续更新插头dp类练习. 学习论文还是cdq那篇<基于连通性状态压缩的动态规划问题>. 基本的想法都讲得很通透了,接下来就靠自己yy了. 还有感谢kuangbin大大 ...

  8. Problem D: 程序填充(递归函数):数列2项和

    Problem D: 程序填充(递归函数):数列2项和 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 2601  Solved: 2117 Descrip ...

  9. windows和linux下杀死Tomcat进程,解决端口占用

    windows和linux下解决Tomcat进程 windows下启动Tomcat报错,8080端口号被占用,报错信息如下 两种解决方法,一种是关闭了这个端口号,另外一种是修改Tomcat下的serv ...

  10. Educational Codeforces Round 9 D. Longest Subsequence dp

    D. Longest Subsequence 题目连接: http://www.codeforces.com/contest/632/problem/D Description You are giv ...