MCPcopy Create free account
hub / github.com/dobin/SuperMega / ui_string_decode

Function ui_string_decode

helper.py:139–151  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

137
138
139def ui_string_decode(data):
140 res = ""
141 try:
142 if len(data) > 32:
143 res = "Data with len {}".format(len(data))
144 elif b"\x00\x00" in data:
145 res = "(utf16) " + data.decode("utf-16le")
146 else:
147 res = "(utf8) " + data.decode("utf-8")
148 except Exception as e:
149 res = "(bytes) " + data.hex()
150
151 return res
152
153
154def ascii_to_hex_bytes(ascii_bytes):

Callers 1

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected