third_party/blink/tools/gdb/blink.py
def ustring_to_string(ptr, length=None):
    """Convert a pointer to UTF-16 data into a Python string encoded with utf-8.

    ptr and length are both gdb.Value objects.
    If length is unspecified, will guess at the length."""
    error_message = ''
    if length is None:
        length, error_message = guess_string_length(ptr)
    else:
        length = int(length)
    char_vals = [int((ptr + i).dereference()) for i in range(length)]
    string = struct.pack('H' * length, *char_vals).decode(
        'utf-16', 'replace').encode('utf-8')
    return string + error_message
Convert a pointer to UTF-16 data into a Python string encoded with utf-8.

    ptr and length are both gdb.Value objects.
    If length is unspecified, will guess at the length.
Convert a pointer to UTF-16 data into a Python string encoded with utf-8.
ptr and length are both gdb.Value objects.
If length is unspecified, will guess at the length.
Convert a pointer to UTF - 16 data into a Python string encoded with utf - 8 . ptr and length are both gdb . Value objects . If length is unspecified will guess at the length .
def ustring_to_string(ptr, length=None):
    error_message = ''
    if length is None:
        length, error_message = guess_string_length(ptr)
    else:
        length = int(length)
    char_vals = [int((ptr + i).dereference()) for i in range(length)]
    string = struct.pack('H' * length, *char_vals).decode(
        'utf-16', 'replace').encode('utf-8')
    return string + error_message
def ustring_to_string ( ptr , length = None ) : error_message = '' if length is None : length , error_message = guess_string_length ( ptr ) else : length = int ( length ) char_vals = [ int ( ( ptr + i ) . dereference ( ) ) for i in range ( length ) ] string = struct . pack ( 'H' * length , * char_vals ) . decode ( 'utf-16' , 'replace' ) . encode ( 'utf-8' ) return string + error_message
Convert a pointer to UTF-16 data into a Python string encoded with utf-8.
Convert a pointer to UTF - 16 data into a Python string encoded with utf - 8 .
"""Convert a pointer to UTF-16 data into a Python string encoded with utf-8.

    ptr and length are both gdb.Value objects.
    If length is unspecified, will guess at the length."""
ptr
length