I have a problem about converting.
print "\357\274\221\357\274\221" # 11 , no problem!
In python, it works!
NSLog(@"outCommand:%@", @"\357\274\221\357\274\221");// 1 , loses another letter!
NSLog(@"outCommand:%@", [@"\357\274\221\357\274\221" dataUsingEncoding:NSUTF8StringEncoding]);// <efbc91ef bc91>
How can I convert it correctly in Objective-C or Swift on iOS?
Try this:
char buf[]="\357\274\221\357\274\221";
NSString *str = [NSString stringWithUTF8String:buf];
NSLog(@"%@", str);
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.