Attributed string in user defaults, is RTFD data OK?

  • I have an attributed string that I need to store via NSUserDefaults.

    NSTextView uses RTFD data stream when passing this type of data
    around via the pasteboard. But typically the pastboard doesn't have
    to worry that someone is going to come alond and try to read the data
    with a different OS version :-)

    Is the RTFD data format backwards (and forwards?) compatible? Or
    should I pick another format for storage in NSUserDefaults (or in a
    generic plist), such as an archived attributed string?

    Thanks,
    Jim
  • On Oct 31, 2007, at 9:00 AM, Jim Correia wrote:

    > I have an attributed string that I need to store via NSUserDefaults.
    >
    > NSTextView uses RTFD data stream when passing this type of data
    > around via the pasteboard. But typically the pastboard doesn't have
    > to worry that someone is going to come alond and try to read the
    > data with a different OS version :-)
    >
    > Is the RTFD data format backwards (and forwards?) compatible? Or
    > should I pick another format for storage in NSUserDefaults (or in a
    > generic plist), such as an archived attributed string?

    There are really two RTFD formats; one is the directory-based
    structure used for on-disk storage, and the other is the serialized
    data used on the pasteboard.  The directory-based version is one of
    our common file formats, so it pretty much has to be compatible across
    versions; older OS versions should simply ignore newer tags that they
    don't recognize.  The serialized data format is a fairly simple
    mapping of the directory-based one, so I think the same should apply
    to it.  There are other choices, of course--for example, one could
    choose to use HTML, or a WebArchive if attachments are required; that
    would give you more contact with common standards, but potentially
    less fidelity to the capabilities of NSAttributedString.

    Douglas Davidson
  • On Oct 31, 2007, at 12:20 PM, Douglas Davidson wrote:

    > There are really two RTFD formats; one is the directory-based
    > structure used for on-disk storage, and the other is the serialized
    > data used on the pasteboard.  The directory-based version is one of
    > our common file formats, so it pretty much has to be compatible
    > across versions; older OS versions should simply ignore newer tags
    > that they don't recognize.  The serialized data format is a fairly
    > simple mapping of the directory-based one, so I think the same
    > should apply to it.

    Thanks Douglas. I need to store this in NSUserDefaults, and
    potentially in a standalone plist, so I need a serialized format.
    This will be a small attributed string, but there may be (small)
    attachments. If RTFD should work OK across OS releases, that seems
    like the path of least resistance here since my needs are simple.

    Jim
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today