


























In android vcard file, the QuotedPrintable string will be like:
ENCODING=QUOTED-PRINTABLE:=E9=A3=9E;=E5=88=98;=E7=A7=8D;=E5=85=88=E7=94=9F;=E5=8F=B7
while in the outlook vcard, it will like:
ENCODING=QUOTED-PRINTABLE:=E5=95=8A=E5=95=8A
that mean that the android will not encode the normail char
so update one decode method, which I find in the internet:
代码
/// <summary>
/// Decodes a QuotedPrintable encoded string
///
/// </summary>
/// <param name="_ToDecode">The encoded string to decode</param>
/// <returns>Decoded string</returns>
public static string DecodeTest(string _ToDecode, string encoderName)
{
//remove soft-linebreaks first
//_ToDecode = _ToDecode.Replace("=\r\n", "");
Encoding encoding;
if (string.IsNullOrEmpty(encoderName))
{
encoding = Encoding.Default;
}
else
{
try
{
encoding = Encoding.GetEncoding(encoderName);
// encoding = Encoding.Default;
}
catch
{
encoding = Encoding.Default;
}
}char[] chars = _ToDecode.ToCharArray();// byte[] bytes = new byte[chars.Length];
List<byte> bytes = new List<byte>();
int bytesCount = 0;
StringBuilder sb
= new StringBuilder();string Hex = string.Empty;此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。