Crate ctb_formats_unicode

Crate ctb_formats_unicode 

Source
Expand description

Utilities for Unicode, including:

  • Character descriptions, annotations, aliases, and meanings
  • Conversion of scalars to surrogates and vice versa
  • UCS-2 encoding and decoding from scalars

Re-exports§

pub use character_description::ControlNameFormat;
pub use character_description::DescriptionMode;
pub use character_description::DescriptionOptions;
pub use character_description::UnicodeVersion;
pub use character_description::describe;
pub use character_description::describe_codepoint;
pub use character_description::describe_codepoint_with_options;
pub use character_description::describe_with_options;

Modules§

character_description
Independent reimplementation of Andrew West’s “What Unicode Character is This” tool.
cli
CLI execution helpers for Unicode character descriptions.

Structs§

BidiClass
Enumerated property Bidi_Class
CanonicalCombiningClass
Property Canonical_Combining_Class. See UAX #15: https://www.unicode.org/reports/tr15/.
UnicodeCharRecord
Character metadata record for generating the unified Unicode character table.
UnicodeDataTables
Complete dataset tables for a specific Unicode version.

Enums§

GeneralCategory
Enumerated property General_Category.

Constants§

UNICODE_HISTORIC_MAX
UNICODE_MAX

Functions§

bidi_class_code
Returns the standard Bidi class abbreviation for a code point (e.g. “L”, “R”, “BN”).
combine_surrogates
Combines surrogate pairs in an iterator of code units into Unicode scalar values. Unpaired surrogates are left as-is.
combining_class
Returns the canonical combining class for a code point (0..=254).
describe_general_category
Expand a Unicode general category abbreviation into a human-readable description.
find_block
Finds the block name for a codepoint in Unicode 17.0.
find_block_with_version
Finds the block name for a codepoint in the given version if it belongs to one.
general_category
Returns the Unicode General Category for a character using compiled ICU4X data.
general_category_code
Returns the 2-letter general category code for a code point (e.g. “Lu”, “Cc”).
get_assigned_unicode_records
Iterates over all assigned Unicode characters and produces structured records.
get_tables
get_unicode_name
Returns the official canonical Unicode character name for a code point in the current supported Unicode standard, including standard names, control character names, and algorithmic names.
get_unicode_name_for_version
Returns the official canonical Unicode character name for a code point for a specific Unicode version, including standard names, control character names, and algorithmic names.
is_assigned_unicode
Checks if a codepoint is an assigned character in Unicode 17.0.
is_deprecated_unicode
Returns true if the character is marked deprecated in the Unicode standard.
is_format_char
Returns true if the character belongs to General Category Cf (Format).
is_known_unicode_name
Returns true if a given name matches any canonical or aliased Unicode character name.
is_nfc_normalized
Returns true if a UTF-8 string is already in Unicode Normalization Form C (NFC).
is_valid_unicode_script
Checks if a string is a valid Unicode script name (e.g. “Latin”, “Arabic”, “Common”).
js_like_slice_utf16
normalize_nfc
Normalizes a UTF-8 string into Unicode Normalization Form C (NFC).
scalars_to_string_lossy
scalars_to_unpaired_surrogates
Converts a slice of Unicode scalar values (u32) to unpaired surrogates. Codepoints above U+FFFF are split into surrogate pairs. Returns an error for invalid codepoints.
script_name
Returns the canonical script name for a code point (e.g. “Latin”, “Arabic”, “Common”).
string_to_scalars
u16_vec_to_le_bytes
ucs2decode
Decodes a slice of UCS-2/UTF-16 code units (u16) into Unicode scalar values (u32). Surrogate pairs are combined into scalars; unpaired surrogates are left as-is.
ucs2encode
Encodes an array of Unicode scalar values (u32) to UTF-16/UCS-2 code units (Vec<u16>). Surrogate pairs are generated for codepoints above U+FFFF. Returns an error for invalid codepoints.
unpaired_surrogates_to_scalars
Decodes a slice of code units (u32), combining surrogate pairs into scalars. Unpaired surrogates are left as-is.