http://blog.sina.com.cn/s/blog_3e4774e301018cu7.html
在Android下使用自带Email客户端在发送中文名附件时,不管是在PC机上还是在Android设备上,都会显示为乱码,在网上查了些资料,发现跟发送时传送的文件名参数有关系,具体只需要修改packages/apps/Email/emailcommon/src/com/android/emailcommon/internet/Rfc822Output.java文件,将writeOneAttachment函数中的如下内容:
writeHeader(writer, "Content-Type",
attachment.mMimeType + ";\n name=\"" + attachment.mFileName + "\"");
writeHeader(writer, "Content-Transfer-Encoding", "base64");
// Most attachments (real files) will send Content-Disposition. The suppression option
// is used when sending calendar invites.
if ((attachment.mFlags & Attachment.FLAG_ICS_ALTERNATIVE_PART) == 0) {
writeHeader(writer, "Content-Disposition",
"attachment;"
+ "\n filename=\"" + attachment.mFileName + "\";"
+ "\n size=" + Long.toString(attachment.mSize));
}
writeHeader(writer, "Content-Type",
attachment.mMimeType + ";\n name=\"" +
MimeUtility.foldAndEncode2(attachment.mFileName,"Content-Type".length() + 2)
+ "\"");
writeHeader(writer, "Content-Transfer-Encoding", "base64");
// Most attachments (real files) will send Content-Disposition. The suppression option
// is used when sending calendar invites.
if ((attachment.mFlags & Attachment.FLAG_ICS_ALTERNATIVE_PART) == 0) {
writeHeader(writer, "Content-Disposition",
"attachment;"
+ "\n filename=\"" +
MimeUtility.foldAndEncode2(attachment.mFileName,"Content-Disposition".length()
+ 2)
+ "\";"
+ "\n size=" + Long.toString(attachment.mSize));
}