I need to read a utf-16 encoded string that is stored in memory in a python script for LLDB. According to their documentation I'm able to use ReadMemory(address, length, error) but I need to know its length in advance. If not python's decode function fails when it stumbles upon a character it cannot decode (even using the 'ignore' option) and the process stops:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u018e' in position 12: ordinal not in range(128)
Can anyone suggest a way of achieving this? (either using a "python" or "lldb python" implementation). I don't have the original string's length.
Thanks.