Re: Convert between encodings
Re: Convert between encodings
- Subject: Re: Convert between encodings
- From: Douglas Davidson <email@hidden>
- Date: Wed, 6 Dec 2006 10:31:35 -0800
On Dec 6, 2006, at 10:19 AM, malcom wrote:
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?
The best guess I can make is that you are operating from a
fundamental misconception here; you seem to think that NSStrings have
encodings. NSStrings are abstract representations of strings, and
are fundamentally encoding-independent. The data from which one
might create an NSString, on the other hand, and the data one might
extract from one, must have an encoding. You could use, for example
initWithData:encoding: with NSISOLatin1StringEncoding, and then
dataUsingEncoding: with NSUTF8StringEncoding.
Douglas Davidson
_______________________________________________
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