• 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
NSString initWithData: NSUTF8StringEncoding - returns 'nil'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString initWithData: NSUTF8StringEncoding - returns 'nil'


  • Subject: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
  • From: Lance Drake <email@hidden>
  • Date: Fri, 3 Dec 2004 10:52:10 -0700

Hi Cocoa Folks,

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.

Any ideas as to how better to create a UTF8 string from data?

Thanks for whatever insights may come to mind,

Lance Drake

_______________________________________________
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


  • Follow-Ups:
    • Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: text woes, the next chapter
  • Next by Date: Re: NSUserDefaults - When is it written to disk?
  • Previous by thread: Modal Window and Drawer Issue
  • Next by thread: Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
  • Index(es):
    • Date
    • Thread