Re: determining encoding on documents
Re: determining encoding on documents
- Subject: Re: determining encoding on documents
- From: James Quick <email@hidden>
- Date: Mon, 21 Jul 2003 17:46:02 -0400
On Monday, July 21, 2003, at 02:04 PM, Francisco Tolmasky wrote:
I've read it, but mostly I was concerned with opening files that my
app did not create. BBEdit has an autodetect for encodings. If
someone makes a UTF8 file in another program, I want them to be able
to read it from mine.
On Monday, July 21, 2003, at 07:57 AM, James Quick wrote:
On Monday, July 21, 2003, at 03:26 AM, Francisco Tolmasky wrote:
When using loadDataRepresentation:(NSData *)data ofType:(NSString
*)aType how can we determine the encoding of the document? (For
example, UTF8 vs ASCII, etc.)?
(munch)
If it contains just the raw data with no wrapper you could see what
happens by playing
around first with NSData and strings,
The data you are being handed is probably just coming from an AppKit
call to:
data = [NSData dataWithContentsOfFile:thePath];
So if you have reason to believe if is UTF8
string = [NSString initWithData: data encoding: SomeValidStringEncoding
];
Go for it. On a first pass, there is nothing preventing you from
desiging a documment controller class with little more than pathName and
a string to hold the content.
Even if you fail you'll have figured out some stuff.
_______________________________________________
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.