怎么样将Bytes转换成中文?
解决方案
10
char* name[100]; // declaring char array NSString* firstName; // declaring the NSString firstName = [NSString stringWithCString:name encoding:NSASCIIStringEncoding];
10
byte -> data oc的方法 - (instancetype)initWithBytes:(const void *)bytes length:(NSUInteger)length;
80
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingGB_18030_2000); NSData*d = [[NSData alloc] initWithBytes:"\xb3\xac\xbc\xb6\xb9\xdc\xc0\xed" length:8]; NSString *s = [[NSString alloc] initWithData:d encoding:enc]; NSLog(@"%@", s);