new TextDecoder([encoding[, options]])
-
encoding
<string> 标识此TextDecoder
实例支持的encoding
。默认值:'utf-8'
。¥
encoding
<string> Identifies theencoding
that thisTextDecoder
instance supports. Default:'utf-8'
. -
options
<Object>-
fatal
<boolean> 如果解码失败是致命的,则为true
。禁用 ICU 时不支持此选项(请参阅 国际化)。默认值:false
。¥
fatal
<boolean>true
if decoding failures are fatal. This option is not supported when ICU is disabled (see Internationalization). Default:false
. -
ignoreBOM
<boolean> 当true
时,TextDecoder
将在解码结果中包含字节顺序标记。当false
时,字节顺序标记将从输出中删除。此选项仅在encoding
为'utf-8'
、'utf-16be'
或'utf-16le'
时使用。默认值: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
.
-
创建新的 TextDecoder
实例。encoding
可以指定支持的编码之一或别名。
¥Creates a new TextDecoder
instance. The encoding
may specify one of the
supported encodings or an alias.
TextDecoder
类也在全局对象上可用。
¥The TextDecoder
class is also available on the global object.