@@ -544,7 +544,7 @@ added: v8.0.0
544544A Symbol that can be used to declare custom promisified variants of functions,
545545see [ Custom promisified functions] [ ] .
546546
547- ### Class: util.TextDecoder
547+ ## Class: util.TextDecoder
548548<!-- YAML
549549added: v8.3.0
550550-->
@@ -563,23 +563,33 @@ while (buffer = getNextChunkSomehow()) {
563563string += decoder .decode (); // end-of-stream
564564```
565565
566- #### WHATWG Supported Encodings
566+ ### WHATWG Supported Encodings
567567
568568Per the [ WHATWG Encoding Standard] [ ] , the encodings supported by the
569569` TextDecoder ` API are outlined in the tables below. For each encoding,
570- one or more aliases may be used. Support for some encodings is enabled
571- only when Node.js is using the full ICU data (see [ Internationalization] [ ] ).
572- ` util.TextDecoder ` is ` undefined ` when ICU is not enabled during build.
570+ one or more aliases may be used.
573571
574- ##### Encodings Supported By Default
572+ Different Node.js build configurations support different sets of encodings.
573+ While a very basic set of encodings is supported even on Node.js builds without
574+ ICU enabled, support for some encodings is provided only when Node.js is built
575+ with ICU and using the full ICU data (see [ Internationalization] [ ] ).
576+
577+ #### Encodings Supported Without ICU
575578
576579| Encoding | Aliases |
577580| ----------- | --------------------------------- |
578- | ` 'utf8' ` | ` 'unicode-1-1-utf-8' ` , ` 'utf-8' ` |
579- | ` 'utf-16be' ` | |
581+ | ` 'utf-8' ` | ` 'unicode-1-1-utf-8' ` , ` 'utf8' ` |
580582| ` 'utf-16le' ` | ` 'utf-16' ` |
581583
582- ##### Encodings Requiring Full-ICU
584+ #### Encodings Supported by Default (With ICU)
585+
586+ | Encoding | Aliases |
587+ | ----------- | --------------------------------- |
588+ | ` 'utf-8' ` | ` 'unicode-1-1-utf-8' ` , ` 'utf8' ` |
589+ | ` 'utf-16le' ` | ` 'utf-16' ` |
590+ | ` 'utf-16be' ` | |
591+
592+ #### Encodings Requiring Full ICU Data
583593
584594| Encoding | Aliases |
585595| ----------------- | -------------------------------- |
@@ -621,13 +631,14 @@ only when Node.js is using the full ICU data (see [Internationalization][]).
621631* Note* : The ` 'iso-8859-16' ` encoding listed in the [ WHATWG Encoding Standard] [ ]
622632is not supported.
623633
624- #### new TextDecoder([ encoding[ , options]] )
634+ ### new TextDecoder([ encoding[ , options]] )
625635
626636* ` encoding ` {string} Identifies the ` encoding ` that this ` TextDecoder ` instance
627637 supports. Defaults to ` 'utf-8' ` .
628638* ` options ` {Object}
629639 * ` fatal ` {boolean} ` true ` if decoding failures are fatal. Defaults to
630- ` false ` .
640+ ` false ` . This option is only supported when ICU is enabled (see
641+ [ Internationalization] [ ] ).
631642 * ` ignoreBOM ` {boolean} When ` true ` , the ` TextDecoder ` will include the byte
632643 order mark in the decoded result. When ` false ` , the byte order mark will
633644 be removed from the output. This option is only used when ` encoding ` is
@@ -636,7 +647,7 @@ is not supported.
636647Creates an new ` TextDecoder ` instance. The ` encoding ` may specify one of the
637648supported encodings or an alias.
638649
639- #### textDecoder.decode([ input[ , options]] )
650+ ### textDecoder.decode([ input[ , options]] )
640651
641652* ` input ` {ArrayBuffer|DataView|TypedArray} An ` ArrayBuffer ` , ` DataView ` or
642653 Typed Array instance containing the encoded data.
@@ -652,49 +663,55 @@ internally and emitted after the next call to `textDecoder.decode()`.
652663If ` textDecoder.fatal ` is ` true ` , decoding errors that occur will result in a
653664` TypeError ` being thrown.
654665
655- #### textDecoder.encoding
666+ ### textDecoder.encoding
656667
657- * Value: {string}
668+ * {string}
658669
659670The encoding supported by the ` TextDecoder ` instance.
660671
661- #### textDecoder.fatal
672+ ### textDecoder.fatal
662673
663- * Value: {boolean}
674+ * {boolean}
664675
665676The value will be ` true ` if decoding errors result in a ` TypeError ` being
666677thrown.
667678
668- #### textDecoder.ignoreBOM
679+ ### textDecoder.ignoreBOM
669680
670- * Value: {boolean}
681+ * {boolean}
671682
672683The value will be ` true ` if the decoding result will include the byte order
673684mark.
674685
675- ### Class: util.TextEncoder
686+ ## Class: util.TextEncoder
676687<!-- YAML
677688added: v8.3.0
678689-->
679690
680691> Stability: 1 - Experimental
681692
682693An implementation of the [ WHATWG Encoding Standard] [ ] ` TextEncoder ` API. All
683- instances of ` TextEncoder ` only support ` UTF-8 ` encoding.
694+ instances of ` TextEncoder ` only support UTF-8 encoding.
684695
685696``` js
686697const encoder = new TextEncoder ();
687698const uint8array = encoder .encode (' this is some data' );
688699```
689700
690- #### textEncoder.encode([ input] )
701+ ### textEncoder.encode([ input] )
691702
692703* ` input ` {string} The text to encode. Defaults to an empty string.
693704* Returns: {Uint8Array}
694705
695- UTF-8 Encodes the ` input ` string and returns a ` Uint8Array ` containing the
706+ UTF-8 encodes the ` input ` string and returns a ` Uint8Array ` containing the
696707encoded bytes.
697708
709+ ### textDecoder.encoding
710+
711+ * {string}
712+
713+ The encoding supported by the ` TextEncoder ` instance. Always set to ` 'utf-8' ` .
714+
698715## Deprecated APIs
699716
700717The following APIs have been deprecated and should no longer be used. Existing
0 commit comments