GetEncoding() public method

Gets the body encoding.
public GetEncoding ( ) : Encoding
return System.Text.Encoding
Example #1
0
        /// <summary>
        /// Sets the message body.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="child">The child.</param>
        private void SetMessageBody(SidePOPMailMessage message, MimeEntity child)
        {
            Encoding encoding = child.GetEncoding();

            message.Body         = ContentDecoder.DecodeString(child);;
            message.BodyEncoding = encoding;
            message.IsBodyHtml   = string.Equals(MediaTypes.TextHtml, child.ContentType.MediaType, StringComparison.InvariantCultureIgnoreCase);
        }
Example #2
0
        /// <summary>
        /// Use the specified charset to decode the given bytes.
        /// </summary>
        private static string DecodeBytesWithSpecificCharset(byte[] decodedBytes, string charSet)
        {
            Encoding encoding = MimeEntity.GetEncoding(charSet);

            encoding = DetectRealEncoding(decodedBytes, encoding);

            string decodedBytesString = encoding.GetString(decodedBytes);

            return(decodedBytesString);
        }
Example #3
0
 /// <summary>
 /// Sets the message body.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="child">The child.</param>
 private void SetMessageBody(SidePOPMailMessage message, MimeEntity child)
 {
     Encoding encoding = child.GetEncoding();
     message.Body = DecodeBytes(child.Content.ToArray(), encoding);
     message.BodyEncoding = encoding;
     message.IsBodyHtml = string.Equals(MediaTypes.TextHtml,
                                        child.ContentType.MediaType, StringComparison.InvariantCultureIgnoreCase);
 }