MCPcopy Index your code
hub / github.com/nodejs/node / #prepareConverter

Method #prepareConverter

lib/internal/encoding.js:464–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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);

Callers 1

constructorMethod · 0.95

Calls 1

lazyStringDecoderFunction · 0.85

Tested by

no test coverage detected