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

C# Quoted-Printable編碼、解碼

復(fù)制代碼 代碼如下:
# 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 (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技術(shù)C# Quoted-Printable編碼、解碼,轉(zhuǎn)載需保留來源!

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

主站蜘蛛池模板: 97人妻丰满熟妇AV无码 | 亚洲a视频在线 | 亚洲AV综合99一二三四区 | 亚州AV人片一区二区三区99久 | 成年私人影院网站在线看 | 帅小伙和警官同性3p | WWW色视频片内射 | 亚洲天堂2017无码 | 特黄特色大片免费播放器9 特黄特黄aaaa级毛片免费看 | 俄罗斯美女z0z0z0在线 | 久久综合久综合久久鬼色 | 97公开超碰在线视频 | 国产欧美精品国产国产专区 | 成人国产AV精品久久久久 | 国产午夜精品理论片影院 | 曰本真人00XX动太图 | 狠狠色香婷婷久久亚洲精品 | 亚洲精品国产一区二区贰佰信息网 | 一本道色综合手机久久 | 色婷婷国产精品视频一区二区 | 琪琪see色原网色原网站 | 国产传媒18精品A片在线观看 | 俄罗斯老妇女BBXX | 国产精品你懂得 | 免费一级特黄欧美大片久久网 | 动漫AV纯肉无码AV电影网 | 国产中文字幕免费观看 | oldgrand欧洲老妇人 | 亚洲综合日韩中文字幕v在线 | 永久免费在线视频 | 国产 在线 亚洲 欧美 动漫 | 91福利国产在线观看网站 | 91精品专区 | 日韩插啊免费视频在线观看 | 久久黄色片 | 成人在免费观看视频国产 | 国产在线亚洲精品观 | 六级黄色片 | 国产乱码免费卡1卡二卡3卡四卡 | 一个人在线观看的视频 | 51成人精品午夜福利AV免费七 |