new TextDecoder([encoding[, options]])
创建新的 TextDecoder
实例。
encoding
可以指定支持的编码之一或别名。
TextDecoder
类也在全局对象上可用。
encoding
<string> Identifies theencoding
that thisTextDecoder
instance supports. Default:'utf-8'
.options
<Object>fatal
<boolean>true
if decoding failures are fatal. This option is only supported when ICU is enabled (see Internationalization). Default:false
.ignoreBOM
<boolean> Whentrue
, theTextDecoder
will include the byte order mark in the decoded result. Whenfalse
, the byte order mark will be removed from the output. This option is only used whenencoding
is'utf-8'
,'utf-16be'
or'utf-16le'
. Default:false
.
Creates an new TextDecoder
instance. The encoding
may specify one of the
supported encodings or an alias.
The TextDecoder
class is also available on the global object.