Given a TypedArray or an ArrayBuffer instance input and an optional fallbackEncoding
encoding label,
sniffs encoding from BOM with fallbackEncoding fallback and then
decodes the input using that encoding, skipping BOM if it was present.
Notes:
BOM-sniffed encoding takes precedence over fallbackEncoding option per spec.
Use with care.
Always operates in non-fatal mode,
aka replacement. It can convert different byte sequences to equal strings.
This method is similar to the following code, except that it doesn't support encoding labels and
only expects lowercased encoding name:
Implements decode legacy hook.
Given a
TypedArrayor anArrayBufferinstanceinputand an optionalfallbackEncodingencoding label, sniffs encoding from BOM withfallbackEncodingfallback and then decodes theinputusing that encoding, skipping BOM if it was present.Notes:
fallbackEncodingoption per spec. Use with care.This method is similar to the following code, except that it doesn't support encoding labels and only expects lowercased encoding name: