function TextDecoder(encoding, options) {
    if (!(this instanceof TextDecoder)) {
      return new TextDecoder(encoding, options);
    }
    encoding = encoding !== undefined ? String(encoding) : DEFAULT_ENCODING;
    options = ToDictionary(options);
    /** @private */
    this._encoding = getEncoding(encoding);
    if (this._encoding === null || this._encoding.name === 'replacement')
      throw RangeError('Unknown encoding: ' + encoding);

    if (!decoders[this._encoding.name]) {
      throw Error('Decoder not present.' +
                  ' Did you forget to include encoding-indexes.js?');
    }

    /** @private @type {boolean} */
    this._streaming = false;
    /** @private @type {boolean} */
    this._BOMseen = false;
    /** @private @type {?Decoder} */
    this._decoder = null;
    /** @private @type {boolean} */
    this._fatal = Boolean(options['fatal']);
    /** @private @type {boolean} */
    this._ignoreBOM = Boolean(options['ignoreBOM']);

    if (Object.defineProperty) {
      Object.defineProperty(this, 'encoding', {value: this._encoding.name});
      Object.defineProperty(this, 'fatal', {value: this._fatal});
      Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});
    } else {
      this.encoding = this._encoding.name;
      this.fatal = this._fatal;
      this.ignoreBOM = this._ignoreBOM;
    }

    return this;
  }
@constructor
@param {string=} encoding The label of the encoding;
    defaults to 'utf-8'.
@param {Object=} options