Re: Uppercasing text as it is entered
Re: Uppercasing text as it is entered
- Subject: Re: Uppercasing text as it is entered
- From: glenn andreas <email@hidden>
- Date: Thu, 23 Aug 2007 14:15:09 -0500
On Aug 23, 2007, at 1:51 PM, Todd Ransom wrote:
I have an app with a text view where some of the text needs to be
automatically upppercased as it is entered. I do this using a
custom attribute and a subclass of NSTextStorage that returns an
uppercase version of the text whenever that attribute is found.
This works great for English language text but I am running into
problems with some unicode characters.
I am using -[NSString uppercaseString] to uppercase the text but I
am getting an unexpected result. The German ß character returns
"SS" from uppercaseString.
That's because in German the "esset" is a lower case only character -
and corresponds to a double "s", so the uppercase version of it is "SS".
Worse, the lower case version of "SS" may, or may not, be the esset
(depending on what characters are near it).
So it's not that it's unexpected, it's just that the concept of
"convert to upper case" is limited.
There are a number of other accented characters that also don't have
uppercase equivalents (a little playing with the character palette
shows "latin small letter w with ring above" ẘ (0x1e98) that doesn't
have an uppercase form - similarly for the y with ring ẙ), as well
as probably a number of other entities that expand to a different
number of characters when case is changed (such as a bunch of things
that are listed as "letterlike symbols"). There are also some
special symbols (such as the "planck constant" ℎ) which would have
an uppercase version (H), but you'd not want to convert (since it
would then refer to something else all together).
At the very least you should check to see if the lowercase string
form of the uppercase string form creates the same starting character.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | flame : flame fractals & strange attractors : build,
mutate, evolve, animate
_______________________________________________
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