• 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
stringWithContentsOfFile:usedEncoding returns no err and no encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stringWithContentsOfFile:usedEncoding returns no err and no encoding


  • Subject: stringWithContentsOfFile:usedEncoding returns no err and no encoding
  • From: Trygve Inda <email@hidden>
  • Date: Fri, 30 May 2014 21:59:01 -0700
  • Thread-topic: stringWithContentsOfFile:usedEncoding returns no err and no encoding

I have a database file exported as text from FileMaker which has several
high-ASCII French characters.

NSError* error = nil;
NSStringEncoding* enc = nil;

NSString* contents = [NSString stringWithContentsOfFile:path
usedEncoding:enc error:&error];


This works but enc and error are both nil after the method returns, even
though contents is correct.

NSString* contents = [NSString stringWithContentsOfFile:path encoding:
NSASCIIStringEncoding error:&error];

This one returns no error but the high ASCII French acented chars are messed
up.

NSString* contents = [NSString stringWithContentsOfFile:path encoding:
NSUTF8StringEncoding error:&error];

This returns error 261 (file can't be interpreted).


So why in the first example is it working (no error) but also not returning
any encoding value?

Trygve



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: stringWithContentsOfFile:usedEncoding returns no err and no encoding
      • From: Greg Parker <email@hidden>
  • Prev by Date: Re: How to write a .icns file
  • Next by Date: Re: stringWithContentsOfFile:usedEncoding returns no err and no encoding
  • Previous by thread: NSTextFieldCell Drawing Offset in NSTextView
  • Next by thread: Re: stringWithContentsOfFile:usedEncoding returns no err and no encoding
  • Index(es):
    • Date
    • Thread