Convert between encodings
Convert between encodings
- Subject: Convert between encodings
- From: malcom <email@hidden>
- Date: Wed, 6 Dec 2006 19:19:20 +0100
I've just asked this question some time ago but I've not received any
solution. So now I try again with other words.
Suppose to have some data written to a file (this data was taken using
NSISOLatin1StringEncoding and then saved to file).
Now I need to get it (NSData or NSString) and convert to
NSUTF8StringEncoding (it contains an header that tell me what kind of
encoding is used).
How can I need to proceed?
Case 1:
NSData *data = [self getDataInRange: _rg];
NSString *str = [[NSString alloc] initWithData: data encoding:
NSUTF8StringEncoding];
don't recognize the utf8chars.
Case 2:
NSData *data = [self getDataInRange: _rg];
NSString *str = [[NSString alloc] initWithData: data encoding:
NSISOLatin1StringEncoding];
NSString *utf8string = [[NSString alloc] initWithUTF8String: [str
cString]/[str utf8String]...]
same thing...
What's the way to convert an NSString (that basically works with unicode)
from one encoding to another?
Thank you very much.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden