Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
- Subject: Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
- From: Douglas Davidson <email@hidden>
- Date: Fri, 3 Dec 2004 10:04:45 -0800
On Dec 3, 2004, at 9:52 AM, Lance Drake wrote:
I'm reading an RTF file which is contained in a binary file. I need
to create an RTF file on the HD - but am having a problem when I try
to move the data thru the system.
The following line of code works 'sometimes' with the same data:
NSString* theString = [[NSString alloc] initWithData:strData
encoding:NSUTF8StringEncoding];
This line of code always works - with the very same data input:
NSString* theString = [[NSString alloc] initWithData:strData
encoding:NSASCIIStringEncoding];
The data is an RTF file which currently does not contain any special
UTF8 characters - but could.
The contents of an RTF file may look like a string, but they're not;
they should be treated as data. Leave it as an NSData and read and
write it using NSData methods.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden