Re: Find with Nonspacing_Mark
Re: Find with Nonspacing_Mark
- Subject: Re: Find with Nonspacing_Mark
- From: "Ken Ferry" <email@hidden>
- Date: Mon, 29 Dec 2008 01:13:46 -0500
Take a look at -[NSString rangeOfString:options:range:locale:]. I'm
not familiar with Thai, but NSDiacriticInsensitiveSearch seems to be
the option required to make this search work.
If you think that there's something wrong with this particular case,
you can file a bug against Cocoa, but you might also want to file one
against ICU, <http://icu-project.org/>. It's the ICU tables that
determine string equality in Cocoa.
-Ken
On Mon, Dec 29, 2008 at 12:39 AM, Gerriet M. Denkmann
<email@hidden> wrote:
>
> On 29 Dec 2008, at 03:02, "Gerriet M. Denkmann" <email@hidden>
> wrote:
>>
>>
>> I have a NSTextView which contains "บุ" that is: THAI CHARACTER BO
>> BAIMAI + THAI CHARACTER SARA U, which is a consonant, followed by a
>> vowel.
>>
>> When I use the Find Panel to search for "บ" (using "Contains" or:
>> "Starts with") nothing is found.
>>
>> Same in TextEdit; same with any character + Nonspacing_Mark.
>>
>> When I enter "a" + COMBINING DIAERESIS and search for "ä" (LATIN SMALL
>> LETTER A WITH DIAERESIS) the character, which looks like "ä" is found.
>> Searching for "a" does not find it.
>> This makes some sense.
>>
>> But to treat "นุ" as one letter is just plain silly and quite wrong.
>>
>> How can I tell the Find Panel (or the NSTextView) to find my
>> characters, even if they are followed by some other character?
>>
>> 10.5.6
>
> I tried this:
> NSString *bu = @"บุ";
> NSString *ba = @"บ";
> NSRange ra = [ bu rangeOfString: ba ];
> if ( ra.location == NSNotFound )
> {
> NSLog(@"%s There is no \"%@\" in \"%@\"",__FUNCTION__, ba, bu );
> }
> else
> {
> NSLog(@"%s range of \"%@\" in \"%@\" is %@",__FUNCTION__, ba, bu,
> NSStringFromRange(ra));
> };
>
> and got the answer:
> There is no "บ" in "บุ"
> which somehow boggles my mind (might be a problem of aforementioned mind
> though).
>
> What do I do now: write my own version of rangeOfString: ? I would rather
> like to avoid this.
>
>
> 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
>
_______________________________________________
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