Module Quickjs_c.Libunicode

Low-level bindings to QuickJS's libunicode - Unicode Character Utilities

Unicode character classification and case conversion. These are raw C bindings; for a higher-level API, use Quickjs.Unicode.

Character Classification

Check if character has uppercase/lowercase variants (Cased property)

Check if character is ignored during case mapping (Case_Ignorable)

Check if character can start an identifier (ID_Start)

Check if character can continue an identifier (ID_Continue)

Check if character is whitespace per ECMA-262 (WhiteSpace or LineTerminator). This is the exact predicate QuickJS uses for regexp \s, String.prototype.trim, and the whitespace skipped by parseInt/parseFloat.

Case Conversion

Convert character case. conv_type: 0 = uppercase, 1 = lowercase, 2 = case folding Returns number of output codepoints (1-3)

Canonicalize character for case-insensitive regex matching. is_unicode: true = full Unicode folding, false = ASCII only

Normalization

Normalize Unicode string. n_type: 0 = NFC, 1 = NFD, 2 = NFKC, 3 = NFKD Returns length of output, or -1 on error

Free buffer allocated by normalize

Character Ranges

Look up a Unicode character range table by name. kind: 0 = Script, 1 = Script_Extensions, 2 = General_Category, 3 = binary property. On success returns the number of points (always even) with the buffer stored in dst; each pair points.(2i), points.(2i+1) encodes a half-open interval. Release the buffer with char_range_free. Returns -1 on memory error, -2 when the name is unknown.

Free buffer returned by char_range