Re: Where is my bicycle?
Re: Where is my bicycle?
- Subject: Re: Where is my bicycle?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 07 Apr 2015 00:10:47 +0700
> On 6 Apr 2015, at 23:52, Steve Mills <email@hidden> wrote:
>
> On Apr 6, 2015, at 11:45:52, Gerriet M. Denkmann <email@hidden> wrote:
>>
>>>
>>>> NSString *string = @"abc 🚲 xyz"; // BICYCLE = U+1F6B2
>>>
>>
>> If this is so: why did my compiler not tell me about this?
>>
>> NSString *string = @"abc 〄 xyz"; // JAPANESE INDUSTRIAL STANDARD SYMBOL = U+3004
>
> Perhaps because U=3004 is a 2-byte value and U+1f6b2 is not? Have you tried changing the encoding of your source file to something else? You'll probably have to store such strings in .strings or hardcode the hex values and build the strings from that.
You are right:
My string looks like:
string "abc 🚲 xyz" contains:
char[ 0] = 0x00061
char[ 1] = 0x00062
char[ 2] = 0x00063
char[ 3] = 0x00020
char[ 4] = 0x1f6b2 ← this is a bicycle
char[ 5] = 0x00020
char[ 6] = 0x00078
char[ 7] = 0x00079
char[ 8] = 0x0007a
which seems ok.
But when I print the bits in NSCharacterSet bitmapRepresentation I get:
bit[ 1] = 0x00020 = " "
bit[ 2] = 0x00061 = "a"
bit[ 3] = 0x00062 = "b"
bit[ 4] = 0x00063 = "c"
bit[ 5] = 0x00078 = "x"
bit[ 6] = 0x00079 = "y"
bit[ 7] = 0x0007a = "z"
bit[ 8] = 0x0f6b2 = "" ← this should be 0x1f6b2, which is a bicycle.
Looks like there is a bug in characterSetWithCharactersInString, or not?
Kind regards,
Gerriet.
_______________________________________________
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