TextDecoder.fatal

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

TextDecoder 接口的只读属性 fatal 是一个布尔值,表示错误模式是否是致命的。

如果这个值是 true,那么当解码器在解码时遇到格式错误的数据时,将抛出 TypeError 错误。如果值是 false,则解码器将使用替换字符 U+FFFD(�)替换无效的数据。属性值在 TextDecoder() 构造函数中设置。

一个布尔值,如果错误模式设置为 fatal,它将返回 true。否则返回 false,表示错误模式是“replacement”。

规范

Specification
Encoding
# ref-for-dom-textdecoder-fatal①

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
fatal

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support