@exodus/bytes
    Preparing search index...

    Module @exodus/bytes/single-byte.js

    Decode / encode the legacy single-byte encodings according to the Encoding standard (§9, §14.5), and unicode.org iso-8859-* mappings.

    import { createSinglebyteDecoder, createSinglebyteEncoder } from '@exodus/bytes/single-byte.js'
    import { windows1252toString, windows1252fromString } from '@exodus/bytes/single-byte.js'
    import { latin1toString, latin1fromString } from '@exodus/bytes/single-byte.js'
    Warning

    This is a lower-level API for single-byte encodings. It might not match what you expect, as it supports both WHATWG and unicode.org encodings under different names, with the main intended usecase for the latter being either non-web or legacy contexts.

    For a safe WHATWG Encoding-compatible API, see @exodus/bytes/encoding.js import (and variants of it).

    Be sure to know what you are doing and check documentation when directly using encodings from this file.

    Supports all single-byte encodings listed in the WHATWG Encoding standard: ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, iso-8859-16, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrillic and x-user-defined.

    Also supports iso-8859-1, iso-8859-9, iso-8859-11 as defined at unicode.org (and all other iso-8859-* encodings there as they match WHATWG).

    Note

    While all iso-8859-* encodings supported by the WHATWG Encoding standard match unicode.org, the WHATWG Encoding spec doesn't support iso-8859-1, iso-8859-9, iso-8859-11, and instead maps them as labels to windows-1252, windows-1254, windows-874.
    createSinglebyteDecoder() (unlike TextDecoder or legacyHookDecode()) does not do such mapping, so its results will differ from TextDecoder for those encoding names.

    > new TextDecoder('iso-8859-1').encoding
    'windows-1252'
    > new TextDecoder('iso-8859-9').encoding
    'windows-1254'
    > new TextDecoder('iso-8859-11').encoding
    'windows-874'
    > new TextDecoder('iso-8859-9').decode(Uint8Array.of(0x80, 0x81, 0xd0))
    '€\x81Ğ' // this is actually decoded according to windows-1254 per TextDecoder spec
    > createSinglebyteDecoder('iso-8859-9')(Uint8Array.of(0x80, 0x81, 0xd0))
    '\x80\x81Ğ' // this is iso-8859-9 as defined at https://unicode.org/Public/MAPPINGS/ISO8859/8859-9.txt

    All WHATWG Encoding spec windows-* encodings are supersets of corresponding unicode.org encodings, meaning that they encode/decode all the old valid (non-replacement) strings / byte sequences identically, but can also support a wider range of inputs.

    Functions

    createSinglebyteDecoder
    createSinglebyteEncoder
    latin1fromString
    latin1toString
    windows1252fromString
    windows1252toString