Ejemplo n.º 1
0
        public static string Encode(string InValue, MimeHeaderLineTraits InHdrTraits)
        {
            QuotedPrintableTraits qpTraits =
                CalcQuotedPrintableTraits(InHdrTraits);
            string ec      = QuotedPrintable.Encode(InValue, qpTraits);
            string results = "=?" + InHdrTraits.EncoderCharSet + "?Q?" + ec + "?=";

            return(results);
        }
 // -------------------------- EncodeAsRequired ------------------------------
 // encode the string if "RequiresEncoding".  Otherwise, return the input string
 // as is.
 public static string EncodeAsRequired(
     string InValue, QuotedPrintableTraits InTraits)
 {
     if (QuotedPrintable.RequiresEncoding(InValue, InTraits) == true)
     {
         StringBuilder sb = new StringBuilder(InValue.Length * 2);
         sb.Append("=?" + InTraits.CharSet + "?Q?");
         sb.Append(QuotedPrintable.Encode(InValue, InTraits));
         sb.Append("?=");
         return(sb.ToString( ));
     }
     else
     {
         return(InValue);
     }
 }