Exemple #1
0
        public void Should_handle_encoded_words_separated_by_cr_lf_space()
        {
            var input = "=?iso-8859-1?q?=A1Hola,_se=F1or!?=\r\n =?iso-8859-1?q?=A1Hola,_se=F1or!?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(@"¡Hola, señor!¡Hola, señor!", output);
        }
Exemple #2
0
        public void Should_just_return_original_text_if_encoding_type_is_not_recognised()
        {
            var input = @"=?iso-8859-1?Z?=A1Hola,_se=F1or!?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(input, output);
        }
Exemple #3
0
        public void Should_ignore_invalid_hex_bytes_in_q_encoded_input()
        {
            var input = @"=?iso-8859-1?Q?=Z4Hola,_se=F1or!?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(@"=Z4Hola, señor!", output);
        }
Exemple #4
0
        public void Should_fall_back_to_8859_if_character_set_invalid()
        {
            var input = @"=?wrong?Q?=A1Hola,_se=F1or!?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(@"¡Hola, señor!", output);
        }
Exemple #5
0
        public void Should_decode_multiple_quoted_blocks()
        {
            var input = @"Normal and multiple =?iso-8859-1?Q?=A1Hola,_se=F1or!?= quoted blocks =?iso-8859-1?B?U29tZSB0ZXN0IHRleHQ=?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(@"Normal and multiple ¡Hola, señor! quoted blocks Some test text", output);
        }
Exemple #6
0
        public void Should_decode_upper_case_q_quoted_text()
        {
            var input = @"=?iso-8859-1?Q?=A1Hola,_se=F1or!?=";

            var output = RFC2047.Decode(input);

            Assert.Equal(@"¡Hola, señor!", output);
        }
Exemple #7
0
        public void Should_decode_lower_case_b_quoted_text()
        {
            var base64String = Convert.ToBase64String(Encoding.UTF8.GetBytes("Some test text"));
            var input        = String.Format(@"=?iso-8859-1?b?{0}?=", base64String);

            var output = RFC2047.Decode(input);

            Assert.Equal(@"Some test text", output);
        }
Exemple #8
0
        public void Should_decode_q_encoded_text_back_to_original_text()
        {
            var inputText         = "¡Hola, señor!";
            var inputCharacterSet = "iso-8859-1";
            var encodingType      = RFC2047.ContentEncoding.QEncoding;
            var encoded           = RFC2047.Encode(inputText, encodingType, inputCharacterSet);

            var result = RFC2047.Decode(encoded);

            Assert.Equal(inputText, result);
        }