The string to encode
Optionalformat: "uint16"Output format (default: 'uint16')
The encoded bytes
Encode a string to UTF-16 bytes (loose mode)
Replaces invalid Unicode (unpaired surrogates) with replacement codepoints U+FFFD
per WHATWG Encoding specification.
Such replacement is a non-injective function, is irreversible and causes collisions.
Prefer using strict throwing methods for cryptography applications.
The string to encode
Output format (default: 'uint16')
The encoded bytes
Encode a string to UTF-16 bytes (loose mode)
Replaces invalid Unicode (unpaired surrogates) with replacement codepoints U+FFFD
per WHATWG Encoding specification.
Such replacement is a non-injective function, is irreversible and causes collisions.
Prefer using strict throwing methods for cryptography applications.
The string to encode
Output format (default: 'uint16')
The encoded bytes
Encode a string to UTF-16 bytes (loose mode)
Replaces invalid Unicode (unpaired surrogates) with replacement codepoints U+FFFD
per WHATWG Encoding specification.
Such replacement is a non-injective function, is irreversible and causes collisions.
Prefer using strict throwing methods for cryptography applications.
The string to encode
Optionalformat: Utf16FormatOutput format (default: 'uint16')
The encoded bytes
Encode a string to UTF-16 bytes (loose mode)
Replaces invalid Unicode (unpaired surrogates) with replacement codepoints
U+FFFDper WHATWG Encoding specification.Such replacement is a non-injective function, is irreversible and causes collisions.
Prefer using strict throwing methods for cryptography applications.