diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index e4f24046ac7..a29fe031c8b 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -431,7 +431,9 @@ function makeTextDecoderICU() { #prepareConverter() { if (this[kHandle] !== undefined) return; - const handle = getConverter(this[kEncoding], this[kFlags]); + let icuEncoding = this[kEncoding]; + if (icuEncoding === 'gbk') icuEncoding = 'gb18030'; // 10.1.1. GBK's decoder is gb18030's decoder + const handle = getConverter(icuEncoding, this[kFlags]); if (handle === undefined) throw new ERR_ENCODING_NOT_SUPPORTED(this[kEncoding]); this[kHandle] = handle;