lumisoft邮件内容中文乱码问题
修改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邮件内容中文乱码问题的更多相关文章
- 解决gitk显示文件内容中文乱码
解决gitk显示文件内容中文乱码 1.git config 命令 设置git gui的界面编码 git config --global gui.encoding utf-8 2.修改配置文件 在~\e ...
- phpstudy 首次安装后打开网站 数据库内容 中文乱码
首次安装完成 phpstudy 后,默认的 my.ini 配置只有数据库文件位置,其他的都没有设置,这时如果想要输出数据库中的中文后,显示到页面上就会变成中文乱码 解决方法: 打开 phpstudy ...
- poi excel文件名或者内容中文乱码
1.文件名乱码处理 // excel文件名 String fileName="我报表"; final SimpleDateFormat formatter = new Simple ...
- zabbix邮件内容乱码与邮件内容为附件解决办法
在zabbix的实际使用过程中,在收到邮件预警的时候,我们会发现邮件内容是乱码的,在手机端收到的是附件,而且附件下载后的文件类型是打不开的.这样我们不知道我们是哪个服务器的哪项服务出了问题,接下来我们 ...
- php 使用phpmailer 发送邮件(附带中文乱码的解决方法)
下载phpmailer ,在程序里包含class.phpmailer.php 类 ,这里有中文乱码的解决方法 实例代码如下 <html> <head> <title&g ...
- C# MailMessage Attachment 中文名附件发邮件-Firefox中文显示正常,网页打开邮件附件中文名乱码
一.故事 首先通过CDO.Message来获取邮件EML相关数据:邮件标题.邮件内容.邮件附件.发件人.收件人.CC主要就这么几个,其次通过MailMessage来组织邮件通过Python来发送邮件! ...
- 用c#读取文件内容中文是乱码的解决方法:
用c#读取文件内容中文是乱码的解决方法: //方法1: StreamReader din = new StreamReader(@"C:\1.txt", System.Text.E ...
- node.js学习4--------------------- 根据不同路径来响应内容,以及中文乱码的解决
/** * http服务器的搭建,相当于php中的Apache或者java中的tomcat服务器 */ // 导包 const http=require("http"); //创建 ...
- windows平台下编辑的内容传到linux平台出现中文乱码的解决办法
现象说明:在windows下编辑的内容,上传到linux平台下出现中文乱码.如下: 在windows平台编写haha.txt文件,内容如下: 上传到linux平台,出现中文乱码,如下: 基本上面出现的 ...
随机推荐
- ConcurrentHashMap的使用
http://blog.csdn.net/gjt19910817/article/details/47353909 Long oldValue, newValue; while(true) { old ...
- 用eclipse运行项目时怎么设置虚拟机内存大小
方法一: 打开eclipse,选择Window--Preferences...在对话框左边的树上双击Java,再双击InstalledJREs,在右边选择前面有对勾的JRE,再单击右边的“Edit”按 ...
- css文件放在头部的原因
我在博问上发的一个这个问题 然后有人这样回复我的 我感觉很有道理的样子 所以我放上来了 这样会先加载css的样式,在渲染dom的时候已经知道了自己的样式了,所以一次渲染成功 如果css放在底部,那么需 ...
- Word Search——经典题(还没细看)
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from l ...
- Genymotion的2个问题及解决方法
问题一:Unable to connect to your virtual device 解决方法:基本都是内存不够导致的,在virtualbox中调整对应虚拟机的内存,确保任务管理器中的性能一项中剩 ...
- nodejs安装sharp出错的问题
PS D:\report\source\lpd-planning-allocation> yarn yarn install v1.3.2 [/] Resolving packages... [ ...
- 快速判断&求出区间相交的长度
有两个区间A[a1,b1], B[a2,b2],判断这两个区间有没有交集.我们可以分为两种思维来判断: /** *思路就是如果两个区间不相交,那么最大的开始端一定大于最小的结束端 **/ if(max ...
- ZSTU OJ 4272 最佳淘汰算法
线段树. 处理出每个位置下一个位置是哪里.然后搞个线段树找一下最大值就可以了. #include<map> #include<set> #include<ctime> ...
- grep 参数
功能说明:查找文件里符合条件的字符串. 语 法:grep [-abcEFGhHilLnqrsvVwxy][-A<显示列数>][-B<显示列数>][-C<显示列数>] ...
- 对有些反编译不成功的apk,请更新最新的apktool.jar、 dex2jar试试
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 对有些反编译不成功的apk,请更新最新的apktool.jar. dex2jar试试 a ...