Reputation: 3766
The following string is working perfectly in android,please give me suggestion for encoding this in ios.
Android Example:String s = "hhh"; s.getBytes("Windows-1252");
Upvotes: 2
Views: 1206
Reputation: 318944
A quick look at the docs for NSString
would give you:
NSString *s = @"hhh";
NSData *data = [s dataUsingEncoding:NSWindowsCP1252StringEncoding];
uint_8 *bytes = [data bytes];
Upvotes: 4
Reputation: 34839
The equivalent code in iOS looks like this
NSString *str = @"hhh";
char buffer[100];
[str getCString:buffer maxLength:100 encoding:NSWindowsCP1252StringEncoding];
Upvotes: 0