Documentation
¶
Overview ¶
Package uformat provides pure rune→string formatting helpers for Unicode byte representations. All functions are stateless and have no side effects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Codepoint ¶ added in v0.10.1
Codepoint returns the Unicode codepoint notation for r, e.g. "U+0041" or "U+1F600". Uses a minimum of four uppercase hex digits.
func HexUpper ¶ added in v0.10.1
HexUpper returns the minimum-width uppercase hex representation of r. For example, "41" for 'A', "1F600" for '😀'.
func JSONEscaped ¶
JSONEscaped returns the JSON/JavaScript escape sequence for r. For characters outside the BMP (r > U+FFFF), returns a UTF-16 surrogate pair \uXXXX\uXXXX. For BMP characters, returns \uXXXX. This mirrors the PRINT_RUNE_JSON logic in resultset.
func RustEscaped ¶
RustEscaped returns the Rust Unicode escape sequence for r, using the minimum-length uppercase hex representation without leading zeros. For example, U+2713 → "\\u{2713}", U+1F600 → "\\u{1F600}".
func UTF8Bytes ¶
UTF8Bytes returns the UTF-8 encoding of r as a space-separated lowercase two-digit hex byte string. For example, U+2713 → "e2 9c 93".
func UTF8Escaped ¶
UTF8Escaped returns the UTF-8 encoding of r as concatenated \xNN escape sequences, lowercase. For example, U+2713 → "\\xe2\\x9c\\x93".
func UTF8PercentEncoded ¶ added in v0.10.1
UTF8PercentEncoded returns the UTF-8 encoding of r as concatenated percent-encoded bytes, uppercase. For example, U+2713 → "%E2%9C%93". This is the encoding used for non-ASCII bytes in URL percent-encoding.
func UnicodeEscaped ¶
UnicodeEscaped returns the Unicode escape sequence for r. For r ≤ U+FFFF, returns \uXXXX (four uppercase hex digits). For r > U+FFFF, returns \UXXXXXXXX (eight uppercase hex digits).
Types ¶
This section is empty.