Web APIs
TextDecoder.ignoreBOM
Report whether the decoder ignores special BOM handling. For UTF-8, true preserves an initial BOM as a decoded character instead of stripping it. Example console output: true 2 1.
Formal Syntax & Structure
javascript syntaxjavascript
decoder.ignoreBOMReturn Value
boolean
Whether BOM handling is disabled.
Working Example
Example Snippetjavascript
const bytes=Uint8Array.of(239,187,191,65); const d=new TextDecoder("utf-8",{ignoreBOM:true}); console.log(d.ignoreBOM,d.decode(bytes).length,new TextDecoder().decode(bytes).length);