• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: stringWithUTF8String: Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stringWithUTF8String: Question


  • Subject: Re: stringWithUTF8String: Question
  • From: Karl Goiser <email@hidden>
  • Date: Tue, 6 May 2003 16:58:28 +1000

Thanks.

I'll give it a go.

Doesn't answer the question though...
:-)


Karl


On Tuesday, May 6, 2003, at 04:36 PM, j o a r wrote:

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.

  • Follow-Ups:
    • Re: stringWithUTF8String: Question
      • From: Chris Ridd <email@hidden>
References: 
 >Re: stringWithUTF8String: Question (From: j o a r <email@hidden>)

  • Prev by Date: Re: stringWithUTF8String: Question
  • Next by Date: Re: stringWithUTF8String: Question
  • Previous by thread: Re: stringWithUTF8String: Question
  • Next by thread: Re: stringWithUTF8String: Question
  • Index(es):
    • Date
    • Thread