• 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: any way to determine the encoding type of an NSData object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: any way to determine the encoding type of an NSData object?


  • Subject: re: any way to determine the encoding type of an NSData object?
  • From: Francisco Tolmasky <email@hidden>
  • Date: Sun, 4 Jan 2004 05:05:50 -0800

Use:

NSMutableAttributedString's
- (BOOL)readFromURL:(NSURL *)url options:(NSDictionary *)options
documentAttributes:(NSDictionary**)documentAttributes

BOOL success;
NSDictionary *docAttrs;
NSURL *url = [NSURL fileURLWithPath: fileName];
NSMutableDictionary *options= [NSMutableDictionary dictionary];
NSTextStorage *myTextStorage;
success= [text readFromURL: url options: options documentAttributes:
&docAttrs];

[docAttrs objectForKey: @"DocumentType"]; // The MONEY!

I learned this from the source code for TextEdit. It's located
Developer/Examples/AppKit/TextEdit/

This whole encoding nonsense is handled in DocumentReadWrite.m

It's kind of construed when you do this, you need to bypass the normal
file opening behavior to get it to call it with the filename. You'll
see what I'm talking about in controller.m

Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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.

  • Prev by Date: Re: NSImage drawing woes
  • Next by Date: XCode: disabling Run log window
  • Previous by thread: Re: any way to determine the encoding type of an NSData object?
  • Next by thread: NSPopUpButton trouble
  • Index(es):
    • Date
    • Thread