Skip to content

encodeStringKey(value): Uint8Array

Defined in: packages/key-encoding/src/scalars.ts:219

Encode a string as its UTF-8 bytes under encodeBytesKey, so keys sort by Unicode code point.

Code point order equals JavaScript’s < on strings except where a supplementary character (U+10000 and above, held as a surrogate pair) meets a character in U+E000 .. U+FFFF: < compares UTF-16 code units and puts the supplementary character first, code point order puts it last.

string

Uint8Array

INVALID_KEY_VALUE when value is not a string or holds an unpaired UTF-16 surrogate, which UTF-8 cannot represent; refusing it keeps every decoded key equal to the string encoded.