Re: NSAttributedString encoding
Re: NSAttributedString encoding
- Subject: Re: NSAttributedString encoding
- From: Douglas Davidson <email@hidden>
- Date: Tue, 13 May 2003 10:34:15 -0700
On Tuesday, May 13, 2003, at 6:20 AM, Aidas Dailide wrote:
I have a question about NSAttributedString encoding. I haven't found
any commands to set it. Is it possible to do that? How does
NSAttributedString knows which encoding to choose when I am
initiliazing it from string?
If you create an NSAttributedString from an NSString, the encoding
question does not come up, because NSString is already
encoding-independent. If you create an NSString from bytes, you
specify an encoding. It is also possible to create an NSString from a
file, in which case Cocoa will attempt to determine the encoding based
on a BOM if one is present, and using the default encoding if not.
If you load an NSAttributedString directly from a file, using e.g.
readFromURL:options:documentAttributes:, then for rich text documents
there usually will not be an encoding issue. For plain text documents,
Cocoa will again attempt to determine an encoding, or else you can
specify an encoding using the @"CharacterEncoding" key in the options
dictionary.
Douglas Davidson
_______________________________________________
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.