iphone - What encoding do strings found in the Mach-O __DATA segment, __cfstring section use? -


i'm wondering how read strings specific section of mach-o binary. (this binary ios.)

i'm curious strings found in __data segment, __cfstring section. these sections appear contain arrays of simple structures:

nsconstantstring {     class class;     const char *string;     int length; } 

the question comes down to: how decide encoding of string?

it's described in source of cfstring available here. it's either in ascii or utf16 (in processor endian-ness.) see source code of clang, available here. generateconstantstring. constant strings generated this piece of code, getaddrofconstantcfstring. source code says constant cfstring of format

  struct __builtin_cfstring {      const int *isa; // point __cfconstantstringclassreference      int flags;      const char *str;      long length;  }; 

(at least on os x, i'm not sure ios.) flags tells whether it's ascii or utf16.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -