天天躁日日躁狠狠躁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編碼、解碼,轉載需保留來源!

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

主站蜘蛛池模板: 日韩在线中文字幕无码 | 国产欧美一区二区三区免费 | 姑娘日本大全免费观看版中文翻译 | 99久久精品免费看国产一区二区三区 | 精品无码国产AV一区二区三区 | 一品道门免费视频韩国 | 欧美日韩看看2015永久免费 | 久久久无码精品亚洲A片软件 | 久久综久久美利坚合众国 | 国产第81页 | 欧美一区二区三区播放 | 美美哒高清在线播放8 | ppypp午夜限制不卡影院私人 | 污污内射在线观看一区二区少妇 | 妈妈的朋友5在线观看免费完整版中文 | 挺进绝色老师的紧窄小肉六 | 午夜DJ国产精华日本无码 | 国产精品亚洲精品久久品 | 国产精品私人玩物在线观看 | 精品国产乱码久久久久久人妻 | 老司机午夜影院味味 | 久久精品国产亚洲AV影院 | 无码毛片内射白浆视频 | 国产高潮国产高潮久久久久久 | 樱花草在线观看影院 | 亚洲成人免费在线 | 红杏俱乐部 | 亚洲精品成人无码A片在线 亚洲精品成人久久久影院 亚洲精品成人a在线观看 | 久久99精品国产自在自线 | 国产 亚洲 中文在线 字幕 | 高中生高潮抽搐喷出白浆视频 | 小小水蜜桃3视频在线观看 小向美奈子厨房magnet | 亚洲精品AV无码永久无码 | 亚洲国产成人99精品激情在线 | 在线 中文字幕 | 999精品国产人妻无码系列 | 最近更新2019中文字幕国语 | 亚洲欧美一区二区成人片 | 国产超碰精久久久久久无码AV | 99热精品一区 | 免费精品国产日韩热久久 |