()
| 462 | } |
| 463 | |
| 464 | #prepareConverter() { |
| 465 | if (hasIntl) { |
| 466 | let icuEncoding = this[kEncoding]; |
| 467 | if (icuEncoding === 'gbk') icuEncoding = 'gb18030'; // 10.1.1. GBK's decoder is gb18030's decoder |
| 468 | const handle = icuGetConverter(icuEncoding, this[kFlags]); |
| 469 | if (handle === undefined) |
| 470 | throw new ERR_ENCODING_NOT_SUPPORTED(this[kEncoding]); |
| 471 | this[kHandle] = handle; |
| 472 | } else if (this[kEncoding] === 'utf-16le') { |
| 473 | if (this[kFatal]) throw new ERR_NO_ICU('"fatal" option'); |
| 474 | this[kHandle] = new (lazyStringDecoder())(this[kEncoding]); |
| 475 | this[kBOMSeen] = false; |
| 476 | } else { |
| 477 | throw new ERR_ENCODING_NOT_SUPPORTED(this[kEncoding]); |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | decode(input = empty, options = kEmptyObject) { |
| 482 | validateDecoder(this); |
no test coverage detected