Expand description
Canonical text codecs shared across crates: shell single-quote rendering
(sq_quote_buf family, byte-parity ports of upstream git’s quote.c for
2.55), percent-encoding/decoding, and small formatting helpers built on
them. All crates must route quoting/percent work through this module so the
codecs stay single-homed and oracle-verified.
Enums§
- Percent
Decode Error - Failure modes of
percent_decode. - Percent
Encode Mode - Safe-set mode table for
percent_encode, preserving the per-site accept/reject behavior of current call sites.
Functions§
- hex_
byte - Append
bytetooutas two uppercase hex digits. - percent_
decode - Strictly percent-decode
value: every%must introduce a%XXescape with case-insensitive hex digits; all other bytes are copied verbatim. Returns raw bytes — callers own the UTF-8 validation and error wording. - percent_
encode - Percent-encode
valueintoout: safe bytes pass through verbatim, every other byte becomes an uppercase%XXescape. - sq_
quote - Convenience wrapper around
sq_quote_buffor UTF-8 arguments. - sq_
quote_ argv - Port of quote.c
sq_quote_argv: prefix each argument with a space and render it through fullsq_quotesemantics. - sq_
quote_ argv_ pretty - Space-prefixed argv rendering used by trace2
startlines (sq_quote_argv_pretty): each argument goes throughsq_quote_pretty, joined by single spaces. - sq_
quote_ buf - Port of quote.c
sq_quote_buf: always wrap in single quotes, escaping each'or!as'\''/'\!'. The!escape guards against interactive shells’ history expansion, matching upstream 2.55 (need_bs_quote). - sq_
quote_ buf_ pretty - Port of quote.c
sq_quote_buf_pretty: leaveargbare when it is non-empty and every byte is ASCII alphanumeric or one of+,-./:=@_^; otherwise fall back tosq_quote_bufsemantics. An empty argument renders as''. - sq_
quote_ pretty - Convenience wrapper around
sq_quote_buf_prettyfor UTF-8 arguments.