Le 22 déc. 08 à 14:48, Michael Ash a écrit :

On Mon, Dec 22, 2008 at 8:25 AM, Graham Cox <graham....@bigpond.com> wrote:

I ended up writing this category method. I guess it will be reliable, as
it's making no assumptions about encoding.

Actually it is! It assumes that the first character is the first
"character". You'll want to stick in a call to
-rangeOfComposedCharacterSequenceAtIndex: if you want to be 100%
universal.

However I would not hesitate to assume ASCII. The language only allows
ASCII in identifiers, so you can't define, declare, or call a
non-ASCII method directly in code. You could do so by building one at
runtime, but if you're doing such a crazy thing then you deserve
whatever poor behavior you get!

In fact the language allows some strange things.
C99 allows usage of some UCN in identifier (see annex D of C99 reference fo know the full list):

And so, this is valid Obj-C99 (obj-c code compiled using -std=c99) code.

----------------------

int h\u00e1 = 0;

@interface Test {
}

- (void)\u00e1rf;

@end

@implementation Test

- (void)\u00e1rf {}

@end

----------------------_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to