webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
google.protobuf.text_encoding Namespace Reference

Functions

def CEscape (text, as_utf8)
 
def CUnescape (text)
 

Function Documentation

◆ CEscape()

def google.protobuf.text_encoding.CEscape (   text,
  as_utf8 
)
Escape a bytes string for use in an ascii protocol buffer.

text.encode('string_escape') does not seem to satisfy our needs as it
encodes unprintable characters using two-digit hex escapes whereas our
C++ unescaping function allows hex escapes to be any length.  So,
"\0011".encode('string_escape') ends up being "\\x011", which will be
decoded in C++ as a single-character string with char code 0x11.

Args:
  text: A byte string to be escaped
  as_utf8: Specifies if result should be returned in UTF-8 encoding
Returns:
  Escaped string

◆ CUnescape()

def google.protobuf.text_encoding.CUnescape (   text)
Unescape a text string with C-style escape sequences to UTF-8 bytes.