如何将*)xÿª5c'√K'Rk¬É*转换为目标C中的纯文本?

012*_*346 3 iphone xcode hex nsstring nsdata

请检查这里是我的代码

int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";
NSString *strings = [NSString stringWithFormat:@"%c", asciiCode];
NSLog(@"%c",strings);
}
Run Code Online (Sandbox Code Playgroud)

如果值为29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83它应显示为india是我的字符串值,但它显示为)xÿª5c'√K'Rk¬É

Cyr*_*lle 5

int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";
Run Code Online (Sandbox Code Playgroud)

这是无效的.@"..."是NSString,而不是int.

你可以有一个char数组,如下所示:

char *asciiCode = {0x29, 0x78, 0xD8, 0xBB, ...}
Run Code Online (Sandbox Code Playgroud)

您可以使用哪个变成NSString

NSString *strings = [NSString stringWithCString:asciiCode usingEncoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud)