Skip to content

Commit cf150ec

Browse files
committed
lib: gbk decoder is gb18030 decoder per spec
1 parent 2e597de commit cf150ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/encoding.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ function makeTextDecoderICU() {
430430

431431
#prepareConverter() {
432432
if (this[kHandle] !== undefined) return;
433-
const handle = getConverter(this[kEncoding], this[kFlags]);
433+
let icuEncoding = this[kEncoding];
434+
if (icuEncoding === 'gbk') icuEncoding = 'gb18030'; // 10.1.1. GBK's decoder is gb18030's decoder
435+
const handle = getConverter(icuEncoding, this[kFlags]);
434436
if (handle === undefined)
435437
throw new ERR_ENCODING_NOT_SUPPORTED(this[kEncoding]);
436438
this[kHandle] = handle;

0 commit comments

Comments
 (0)