TextDecoder.fatal
TextDecoder 接口的只读属性 fatal 是一个布尔值,表示错误模式是否是致命的。
如果这个值是 true,那么当解码器在解码时遇到格式错误的数据时,将抛出 TypeError 错误。如果值是 false,则解码器将使用替换字符 U+FFFD(�)替换无效的数据。属性值在 TextDecoder() 构造函数中设置。
值
一个布尔值,如果错误模式设置为 fatal,它将返回 true。否则返回 false,表示错误模式是“replacement”。
规范
| Specification |
|---|
| Encoding Standard # ref-for-dom-textdecoder-fatal① |
浏览器兼容性
BCD tables only load in the browser