absl::Utf8SafeCEscape

Escapes a src string using C-style escape sequences, escaping bytes as octal sequences, and passing through UTF-8 characters without conversion.

Synopsis

Declared in <absl/strings/escaping.h>

std::string
Utf8SafeCEscape(std::string_view src);

Description

I.e., when encountering any bytes with their high bit set, this function will not escape those values, whether or not they are valid UTF-8.

Return Value

The escaped string.

Parameters

NameDescription
srcThe string to escape.