日期:2014-05-18  浏览次数:20762 次

如何将汉字正文转为UTF-8,例子:
如何将
“QQ号码申诉联系方式确认(请不要答复此邮件)”
转换为
“=?UTF-8?B?UVHlj7fnoIHnlLPor4nogZTns7vmlrnlvI/noa7orqTvvIjor7fkuI3opoHnrZTlpI3mraTpgq7ku7bvvIk=?=”
再转换为
“QQ鍙风爜鐢宠瘔鑱旂郴鏂瑰紡纭锛堣涓嶈绛斿姝ら偖浠讹級”


------解决方案--------------------
[code=C#] string s = "QQ号码申诉联系方式确认(请不要答复此邮件)";
string r = Convert.ToBase64String(Encoding.UTF8.GetBytes(s));
Response.Write(Encoding.GetEncoding("gb2312").GetString(Convert.FromBase64String(r)) + "<br/>");
r = string.Format("=?UTF-8?B?{0}?=", r);
Response.Write(r);code]
QQ鍙风爜鐢宠瘔鑱旂郴鏂瑰紡纭锛堣涓嶈绛斿姝ら偖浠讹級
=?UTF-8?B?UVHlj7fnoIHnlLPor4nogZTns7vmlrnlvI/noa7orqTvvIjor7fkuI3opoHnrZTlpI3mraTpgq7ku7bvvIk=?=