示例#1
0
 public void CustomDecoderFallback()
 {
     byte[] encoded = { 0x80, 0xA1, 0x83 };
     encoder = new EucJpEncoding(
         new DecoderReplacementFallback("?!"),
         new EncoderExceptionFallback());
     Assert.AreEqual("?!?!?!", encoder.GetString(encoded));
 }
示例#2
0
        public void CustomEncoderFallback()
        {
            string decoded = "€\ud801\udc37";

            encoder = new EucJpEncoding(
                new DecoderExceptionFallback(),
                new EncoderReplacementFallback("?!"));

            byte[] expected = { 0x3F, 0x21, 0x3F, 0x21, 0x3F, 0x21 };
            Assert.AreEqual(expected, encoder.GetBytes(decoded));
        }
示例#3
0
        public void ConstructorSetFallbacks()
        {
            encoder = new EucJpEncoding(
                new DecoderReplacementFallback("@"),
                new EncoderReplacementFallback("@"));
            Assert.IsInstanceOf <DecoderReplacementFallback>(encoder.DecoderFallback);
            Assert.IsInstanceOf <EncoderReplacementFallback>(encoder.EncoderFallback);

            // We can't override original
            Encoding baseEncoding = encoder;

            Assert.IsNotInstanceOf <DecoderReplacementFallback>(baseEncoding.DecoderFallback);
            Assert.IsNotInstanceOf <EncoderReplacementFallback>(baseEncoding.EncoderFallback);
        }
示例#4
0
 public void SetUp()
 {
     encoder = new EucJpEncoding();
 }