Re: stringWithUTF8String: Question
Re: stringWithUTF8String: Question
- Subject: Re: stringWithUTF8String: Question
- From: j o a r <email@hidden>
- Date: Tue, 6 May 2003 08:36:36 +0200
Since you start out with raw data, perhaps you should rather use this
method when creating the string:
- (id)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding
j o a r
On Tuesday, May 6, 2003, at 08:14 Europe/Stockholm, Karl Goiser wrote:
I am having trouble with the stringWithUTF8String: method:
I am reading data from a file - UTF data - like this:
NSData * contentsData = [NSData dataWithContentsOfFile: pathName];
if (contentsData) {
contents = [NSString stringWithUTF8String: [contentsData
bytes]];
...
Intermittently, contents will return as nil. Well, actually, about
50% of the time! I can sit in ProjectBuilder, and hit command-R and
sometimes this routine will work and sometimes it will fail.
This is always on the same, unchanged file which is about 700 bytes
long.
Does anybody have any inkling why this might be so? It's got me!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.