Re: Converting String Representations at Runtime
Re: Converting String Representations at Runtime
- Subject: Re: Converting String Representations at Runtime
- From: Michael Ash <email@hidden>
- Date: Sun, 12 Apr 2009 23:01:28 -0400
On Sun, Apr 12, 2009 at 10:51 PM, Ken Thomases <email@hidden> wrote:
> The above is failing to take into account the assumed knowledge that the
> code points won't be more than 4 characters long. What if you follow a
> \uNNNN sequence with characters (not intended to be part of the \u sequence)
> in the [0-9a-fA-F] set? For example, "bar\u0020foo". -scanHexInt: will
> take that to mean 0x20f. You'd need to -scanCharactersFromSet:intoString:
> to read a sequence of hexadecimal digits, then check the length and back up
> using -setScanLocation: if it was more than 4 digits. Also, you'd truncate
> the resulting string at 4 digits and scan _that_ using -scanHexInt:.
It's not so much "failing to account" as it is "assuming you'll set up
the scanner appropriately". Obviously you would not set the scanner to
run on the original source string, that simply wouldn't work, as you
discuss.
Mike
_______________________________________________
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