• 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: Normalize an NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Normalize an NSAttributedString


  • Subject: Re: Normalize an NSAttributedString
  • From: Ross Carter <email@hidden>
  • Date: Sat, 29 Aug 2009 16:48:06 -0400

On Aug 29, 2009, at 1:22 PM, Ken Thomases wrote:

On Aug 29, 2009, at 11:46 AM, Ross Carter wrote:

Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an attribute is {0, 2}. The string and its attribute are archived separately as xml data like this:
<string>รถ</string>
<attrName>NSFontAttributeName</attrName>
<attrValue location='0', length='2'>Helvetica 12.0</attrValue>


If, during unarchiving, the string is represented by an NSString object in precomposed form, its length will be 1, and an attempt to apply the attribute range of {0, 2} will fail.

But why would it change between archiving and unarchiving?

Because during unarchiving, the NSString is created by NSXMLParser and I assume that there is no guarantee regarding the normalization form of that string. NSXMLParser might decompose the string, for example. It seems to me that to rely on NSXMLParser always to returns strings in a particular form is to rely on an implementation detail.


Admittedly I have not observed any such funny business. I just assume it is possible.

Ross_______________________________________________

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: Normalize an NSAttributedString
      • From: Ken Thomases <email@hidden>
References: 
 >Normalize an NSAttributedString (From: Ross Carter <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Martin Wierschin <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Ross Carter <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Ken Thomases <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Michael Ash <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Ken Thomases <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Ross Carter <email@hidden>)
 >Re: Normalize an NSAttributedString (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Correct way to have nil undo manager in Core Data document?
  • Next by Date: Core Data observer exception in 10.6
  • Previous by thread: Re: Normalize an NSAttributedString
  • Next by thread: Re: Normalize an NSAttributedString
  • Index(es):
    • Date
    • Thread