Wingzero Wingzero - 1 year ago 79
Objective-C Question

LLDB po command encoding format of "\332"

So I got a NSData from backend server, my backend engineer folk says there is a simple decoding logic and I have to get the second byte.

So I have turned this NSdata into bytes array via

const unsigned char *usageBuf = (unsigned char *)[keyData bytes];

When I print it on LLDB, it outputs like:

(lldb) po usageBuf

however when I try to print usageBuf[1], it's like:

(lldb) po usageBuf[0]

(lldb) po usageBuf[1]

(lldb) po/x usageBuf[1]

(lldb) po usageBuf[2]

I am confused how '\332' turned into '\xda'? I searched the UTF8 table, but it just says
UTF-8 0x5C 0x33 0x33 0x32
, so I must be missing some puzzles, please help, thanks!

Avi Avi
Answer Source

It's a matter of numerical base:

hex DA == dec 218 == oct 332

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download