Re: NSString and utf16
Re: NSString and utf16
- Subject: Re: NSString and utf16
- From: Alastair Houghton <email@hidden>
- Date: Wed, 16 Apr 2008 16:53:23 +0100
On 16 Apr 2008, at 16:43, Alexander Cohen wrote:
I have an NSString that contains this Unicode character: '\u00e9'. I
have another app that represents the same character as 'e\u0301'. Is
there any way to transform one to the other so that isEqualToString
returns YES?
Yes. You want to look at the string normalization methods (e.g. -
decomposedStringWithCanonicalMapping).
Which one you want to use before your comparison depends on exactly
what you are trying to achieve; e.g. you might want to use the
compatibility mapping rather than the canonical mapping instead (which
will map superscripts and subscripts, font variants, circled
characters etcetera to related but not entirely equivalent forms).
The book "Unicode Demystified" is quite useful if you get particularly
involved with this kind of thing (as is the Unicode book itself).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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