DiagnosticValue
in package
FinalYes
Escapes control characters and malformed UTF-8 for use in diagnostics.
Table of Contents
Methods
- escape() : string
- Escapes C0, DEL, and C1 controls as uppercase `\xNN` sequences.
Methods
escape()
Escapes C0, DEL, and C1 controls as uppercase `\xNN` sequences.
public
static escape(string $value) : string
ASCII bytes from 0x20 through 0x7E and valid UTF-8 characters outside
those control ranges remain unchanged. If the input is malformed UTF-8 or
PCRE cannot process it, every byte outside printable ASCII is escaped.
Valid C1 characters are rendered as \xNN using their Unicode code
points. During bytewise fallback, each original byte outside printable
ASCII is rendered in the same form. The result is diagnostic text, not a
reversible encoding.
This does not encode values for HTML, JSON, shells, terminals, URLs, or protocol fields.
Parameters
- $value : string