Email中Quoted Printable的解码方法

代码
public   static   string  QPDecode( string  content, string  encodingOption)
        {
            content 
=  content.Replace( " =\r\n " "" ); 

             
char [] chars  =  content.ToCharArray(); 
 
             
byte [] bytes  =   new   byte [chars.Length]; 
 
             
int  bytesCount  =   0
 
             
for  ( int  i  =   0 ; i  <  chars.Length; i ++
             { 
 
                 
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.GetEncoding(encodingOption).GetString(bytes,  0 , bytesCount);
        }


你可能感兴趣的:(table)