Beispiel #1
0
        public static Encoding GetEncoding(int codepage, string fallback)
        {
            if (fallback == null)
            {
                throw new ArgumentNullException(nameof(fallback));
            }

            var encoderFallback = new EncoderReplacementFallback(fallback);
            var decoderFallback = new DecoderReplacementFallback(fallback);

            return(Encoding.GetEncoding(codepage, encoderFallback, decoderFallback));
        }
Beispiel #2
0
        public static Encoding GetEncoding(string charset, string fallback)
        {
            int codepage;

            if (charset == null)
            {
                throw new ArgumentNullException(nameof(charset));
            }

            if (fallback == null)
            {
                throw new ArgumentNullException(nameof(fallback));
            }

            if ((codepage = GetCodePage(charset)) == -1)
            {
                throw new NotSupportedException(string.Format("The '{0}' encoding is not supported.", charset));
            }

            var encoderFallback = new EncoderReplacementFallback(fallback);
            var decoderFallback = new DecoderReplacementFallback(fallback);

            return(Encoding.GetEncoding(codepage, encoderFallback, decoderFallback));
        }
Beispiel #3
0
        public static Encoding GetEncoding(string charset, string fallback)
        {
            int codepage;

            if (charset == null)
            {
                throw new ArgumentNullException("charset");
            }

            if (fallback == null)
            {
                throw new ArgumentNullException("fallback");
            }

            if ((codepage = GetCodePage(charset)) == -1)
            {
                throw new NotSupportedException();
            }

            var encoderFallback = new EncoderReplacementFallback(fallback);
            var decoderFallback = new DecoderReplacementFallback(fallback);

            return(Encoding.GetEncoding(codepage, encoderFallback, decoderFallback));
        }
Beispiel #4
0
		public static Encoding GetEncoding (int codepage, string fallback)
		{
			if (fallback == null)
				throw new ArgumentNullException ("fallback");

			var encoderFallback = new EncoderReplacementFallback (fallback);
			var decoderFallback = new DecoderReplacementFallback (fallback);

			return Encoding.GetEncoding (codepage, encoderFallback, decoderFallback);
		}
Beispiel #5
0
		public static Encoding GetEncoding (string charset, string fallback)
		{
			int codepage;

			if (charset == null)
				throw new ArgumentNullException ("charset");

			if (fallback == null)
				throw new ArgumentNullException ("fallback");

			if ((codepage = GetCodePage (charset)) == -1)
				throw new NotSupportedException ();

			var encoderFallback = new EncoderReplacementFallback (fallback);
			var decoderFallback = new DecoderReplacementFallback (fallback);

			return Encoding.GetEncoding (codepage, encoderFallback, decoderFallback);
		}
Beispiel #6
0
		public static Encoding GetEncoding (string charset, string fallback)
		{
			int codepage;

			if (charset == null)
				throw new ArgumentNullException (nameof (charset));

			if (fallback == null)
				throw new ArgumentNullException (nameof (fallback));

			if ((codepage = GetCodePage (charset)) == -1)
				throw new NotSupportedException (string.Format ("The '{0}' encoding is not supported.", charset));

			var encoderFallback = new EncoderReplacementFallback (fallback);
			var decoderFallback = new DecoderReplacementFallback (fallback);

			return Encoding.GetEncoding (codepage, encoderFallback, decoderFallback);
		}