In Java code, this code can get hex string "efbfbc"
;
new String((((char)-4 )+ "").getBytes("utf8"),"iso8859-1")
How can implement it in iOS Objective-C?
by byte -4, get hex string "efbfbc"
;
In Java code, this code can get hex string "efbfbc"
;
new String((((char)-4 )+ "").getBytes("utf8"),"iso8859-1")
How can implement it in iOS Objective-C?
by byte -4, get hex string "efbfbc"
;
NSString *string = @"efbfbc";
char converted[([string length] + 1)];
NSString* str = [[NSString alloc]
initWithCString: converted encoding: NSISOLatin1StringEncoding];
NSLog(@"Your result string: %@",str);
I got below result:
Check out this AppleDoc for more information about intiWithCString method. It will give you a clear idea.
i have solve the problem.
unichar asciiChar = -4;
NSString *string = [NSString stringWithCharacters:&asciiChar length:1];
string = [NSString stringWithCString:[string UTF8String] encoding: NSISOLatin1StringEncoding];
now , string hex is "efbfbc"
thanks everyone.