Example #1
0
        public IOInfo AddEncoding(RubyContext /*!*/ context, MutableString /*!*/ encoding)
        {
            if (!encoding.IsAscii())
            {
                context.ReportWarning(String.Format("Unsupported encoding {0} ignored", encoding.ToAsciiString()));
                return(this);
            }

            if (HasEncoding)
            {
                throw RubyExceptions.CreateArgumentError("encoding specified twice");
            }

            string[] parts = encoding.ToString().Split(':');
            return(new IOInfo(
                       _mode,
                       TryParseEncoding(context, parts[0]),
                       (parts.Length > 1) ? TryParseEncoding(context, parts[1]) : null
                       ));
        }