shaomei-21

    private string DecodeQP(string code,string charset)
    {
        ArrayList aryBytes = new ArrayList();
        char ch;
        int i = 0;
        while (i < code.Length)
        {
            ch = code[i];
            if (ch == \'=\')
            {
                if (code.Substring(i, 3) == "=\r\n")
                {
                    i += 3;
                }
                else
                {
                    string tmp = code.Substring(i + 1, 2);
                    aryBytes.Add((byte)int.Parse(tmp, System.Globalization.NumberStyles.HexNumber));
                    i += 3;
                }
            }
            else
            {
                aryBytes.Add((byte)ch);
                i++;
            }
        }
        byte[] decodeBytes = new byte[aryBytes.Count];
        for (int j = 0; j < aryBytes.Count; j++)
        {
            decodeBytes[j] = (byte)aryBytes[j];
        }
        //string decode = Encoding.Default.GetString(decodeBytes);
        string decode=Encoding.GetEncoding(charset).GetString(decodeBytes);
        return decode;

    }

分类:

技术点:

相关文章:

  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
猜你喜欢
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
  • 2021-08-30
相关资源
相似解决方案