天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

C# Quoted-Printable編碼、解碼

復制代碼 代碼如下:
# 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: kspaun@spaun-it.de
# /// 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 (http://www.jb51.NET)
# /// 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>
# /// Decodes a QuotedPrintable encoded string
# /// </summary>
# /// <param name="_ToDecode">The encoded string to decode</param>
# /// <returns>Decoded string</returns>
# public static string Decode(string _ToDecode)
# {
# //remove soft-linebreaks first
# //_ToDecode = _ToDecode.Replace("=/r/n", "");
#
# char[] chars = _ToDecode.ToCharArray();
#
# byte[] bytes = new byte[chars.Length];
#
# int bytesCount = 0;
#
# for (int i = 0; i < chars.Length; i++)
# {
# // if encoded character found decode it
# if (chars[i] == '=')
# {
# bytes[bytesCount++] = System.Convert.ToByte(int.Parse(chars[i + 1].ToString() + chars[i + 2].ToString(), System.Globalization.NumberStyles.HexNumber));
#
# i += 2;
# }
# else
# {
# bytes[bytesCount++] = System.Convert.ToByte(chars[i]);
# }
# }
#
# //return System.Text.Encoding.Default.GetString(bytes, 0, bytesCount);
# return System.Text.Encoding.UTF8.GetString(bytes, 0, bytesCount);
# }
# }

AspNet技術C# Quoted-Printable編碼、解碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 色婷婷综合久久久久中文一区二区 | 影音先锋男人资源813. | 日本高清免费观看 | 欧美巨大xxxx做受孕妇视频 | 视频区 国产 欧美 日韩 | 一个人HD在线观看免费高清视频 | 丰满的寡妇hd高清在线观看 | 18禁黄无遮挡禁游戏在线下载 | 国产性夜夜性夜夜爽91 | 久久精品国产清白在天天线 | 丰满人妻妇伦又伦精品APP国产 | 国产成人无码一区AV在线观看 | 久久精品一卡二卡三卡四卡视频版 | 三级中国免费的 | 天天影视色欲 影视 | 国产在线观看的 | 国产高清精品国语特黄A片 国产高清国内精品福利色噜噜 | 小荡娃奶真大 | 回复术士人生重启在线观看 | 久久亚洲AV无码精品午色夜麻豆 | 久久青青草原综合伊人 | 与嫂子同居的日子在线观看 | 久久天堂视频 | 亚瑟天堂久久一区二区影院 | 青青视频国产色偷偷 | 男人插女人动态 | 国内2018年午夜福利5678 | 5g在线视讯年龄确认海外禁止进入 | 亚洲视频中文字幕在线观看 | 国产扒开美女双腿屁股流白浆 | 午夜性色一区二区三区不卡视频 | 朝鲜美女bbwbbw撒尿 | 一道本无吗d d在线播放 | 久久精品国产免费中文 | 中文字幕中文字幕永久免费 | 久久偷拍vs国产在线播放 | 色婷婷国产精品视频一区二区 | 龙腾亚洲人成电影网站 | 日本美女抠逼 | 亚洲精品综合在线影院 | 免费在线亚洲视频 |