麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > C# > 正文

C# Quoted-Printable編碼、解碼

2024-09-07 17:05:17
字體:
來源:轉載
供稿:網友

代碼如下:
# using System;
# using System.Collections;
# using System.Text;
#
# /// <summary>
# /// Class for encoding and decoding a string to QuotedPrintable
# /// RFC 1521 http://www.ietf.org/rfc/rfc1521.txt
# /// RFC 2045 http://www.ietf.org/rfc/rfc2045.txt
# /// Date: 2006-03-23
# /// Author: Kevin Spaun
# /// Company: SPAUN Informationstechnik GmbH - http://www.spaun-it.com/
# /// Feedback: [email protected]
# /// License: This piece of code comes with no guaranties. You can use it for whatever you want for free.
# ///
# /// Modified by Will Huang ( http://blog.miniasp.com/post/2008/02/14/Quoted-Printable-Encoding-and-Decoding.aspx )
# /// Modified at 2008-02-13
# ///
# /// Modified by reterry (//www.companysz.com)
# /// Modified at 2008-11-29
# /// Modified for MySelf
# ///
# /// </summary>
# public class QuotedPrintable
# {
# private const byte EQUALS = 61;
# private const byte CR = 13;
# private const byte LF = 10;
# private const byte SPACE = 32;
# private const byte TAB = 9;
#
# /// <summary>
# /// Encodes a string to QuotedPrintable
# /// </summary>
# /// <param name="_ToEncode">String to encode</param>
# /// <returns>QuotedPrintable encoded string</returns>
# public static string Encode(string _ToEncode)
# {
# StringBuilder Encoded = new StringBuilder();
# string hex = string.Empty;
# //byte[] bytes = Encoding.Default.GetBytes(_ToEncode);
# byte[] bytes = Encoding.UTF8.GetBytes(_ToEncode);
# //int count = 0;
#
# for (int i = 0; i < bytes.Length; i++)
# {
# //these characters must be encoded
# if ((bytes[i] < 33 || bytes[i] > 126 || bytes[i] == EQUALS) && bytes[i] != CR && bytes[i] != LF && bytes[i] != SPACE)
# {
# if (bytes[i].ToString("X").Length < 2)
# {
# hex = "0" + bytes[i].ToString("X");
# Encoded.Append("=" + hex);
# }
# else
# {
# hex = bytes[i].ToString("X");
# Encoded.Append("=" + hex);
# }
# }
# else
# {
# //check if index out of range
# if ((i + 1) < bytes.Length)
# {
# //if TAB is at the end of the line - encode it!
# if ((bytes[i] == TAB && bytes[i + 1] == LF) || (bytes[i] == TAB && bytes[i + 1] == CR))
# {
# Encoded.Append("=0" + bytes[i].ToString("X"));
# }
# //if SPACE is at the end of the line - encode it!
# else if ((bytes[i] == SPACE && bytes[i + 1] == LF) || (bytes[i] == SPACE && bytes[i + 1] == CR))
# {
# Encoded.Append("=" + bytes[i].ToString("X"));
# }
# else
# {
# Encoded.Append(System.Convert.ToChar(bytes[i]));
# }
# }
# else
# {
# Encoded.Append(System.Convert.ToChar(bytes[i]));
# }
# }
# //if (count == 75)
# //{
# // Encoded.Append("=/r/n"); //insert soft-linebreak
# // count = 0;
# //}
# //count++;
# }
#
# return Encoded.ToString();
# }
#
# /// <summary>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 性大片1000免费看 | 国产呻吟| 国产91片 | 激情视频日韩 | 91在线视频精品 | 香蕉久久久精品 | 成人午夜精品久久久久久久3d | 久久精品污 | 高清国产午夜精品久久久久久 | 日韩黄在线| 欧美成人se01短视频在线看 | 伊人一二三四区 | 久久欧美亚洲另类专区91大神 | 国产高潮好爽好大受不了了 | 国产成人在线免费看 | 成人aaaaa片毛片按摩 | 激情夜色 | 久久亚洲一区二区三区成人国产 | 亚洲欧美国产高清va在线播放 | 成年人在线免费播放视频 | 精品成人网 | 在线成人一区二区 | 一级黄色影片在线观看 | 激情视频免费看 | 国产精品欧美久久久久一区二区 | 日韩欧美精品电影 | 黄色网页在线观看 | 干色视频| 主人在调教室性调教女仆游戏 | 久久3| 亚洲国产视频网 | 大学生一级毛片在线视频 | 午夜视频观看 | 羞羞答答视频 | 欧美成人精品欧美一级乱黄 | 水卜樱一区二区av | 精精国产xxxx视频在线野外 | 久久在线精品视频 | av久草| 伊人二本二区 | 5xsq在线视频 |