Skip to content

Commit 9f06e72

Browse files
authored
lib: gbk decoder is gb18030 decoder per spec
PR-URL: #61099 Refs: https://encoding.spec.whatwg.org/#gbk-decoder Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 15bdf38 commit 9f06e72

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)