Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert * )xÿª5c’√K’Rk¬É* to plain text in objective C?

Please check here is my code

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);
}

if the value of 29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83 it should display as india is my string value but it is displaying as )xÿª5c’√K’Rk¬É

like image 340
012346 Avatar asked Jan 27 '26 10:01

012346


1 Answers

int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";

This is invalid. @"..." is a NSString, not an int.

You could have a char array, like this:

char *asciiCode = {0x29, 0x78, 0xD8, 0xBB, ...}

Which you could turn into a NSString using

NSString *strings = [NSString stringWithCString:asciiCode usingEncoding:NSUTF8StringEncoding];
like image 182
Cyrille Avatar answered Jan 29 '26 01:01

Cyrille



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!