In .NET, I can use Encoding.UTF8.GetString(string str)
or any other flavor of Encoding
, to get the string representation of a byte array. Does Cocoa contain similar functionality out-of-the-box, or do I need to write some stuff to make the conversions myself?
You use initWithData:encoding
. Eg:
[[NSString alloc] initWithData: dataObj encoding: NSUTF8StringEncoding]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.