mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
lib: gbk decoder is gb18030 decoder per spec
PR-URL: https://github.com/nodejs/node/pull/61099 Refs: https://encoding.spec.whatwg.org/#gbk-decoder Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
c3e776becd
commit
1c0a1aa5ef
1 file changed
+3
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user