public static function escape(string $raw): string
    {
        $flags = \ENT_QUOTES;

        if (\defined('ENT_SUBSTITUTE')) {
            $flags |= \ENT_SUBSTITUTE;
        }

        $raw = \str_replace(\chr(9), '    ', $raw);

        return \htmlspecialchars($raw, $flags);
    }