• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: rangeOfString & UTF8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rangeOfString & UTF8


  • Subject: Re: rangeOfString & UTF8
  • From: Clark Cox <email@hidden>
  • Date: Sun, 4 Oct 2009 14:17:45 -0700

On Sun, Oct 4, 2009 at 1:48 PM, Steve Cronin <email@hidden> wrote:
> Folks;
>
>  (thePhrase) :  Geschäftsführer (CEO):
>
>  (tString):  Geschäftsführer (CEO)
>
> Both
>        curPos = [thePhrase rangeOfString: tString
> options:NSCaseInsensitiveSearch].location;
>
> AND
>
>        NSLocale *tLocale = [[[NSLocale alloc]
> initWithLocaleIdentifier:@"de_DE"] autorelease];
>        curPos = [thePhrase rangeOfString: tString
> options:NSCaseInsensitiveSearch range:NSMakeRange(0, [thePhrase length])
> locale:tLocale].location;
>
> yield curPos == NSNotFound
>
> Here's some printout from the console:
> Printing description of thePhrase:
> Gesch\u00e4ftsf\u00fchrer (CEO):
>
> Printing description of tString:
> Gesch\u00e4ftsf\u00fchrer (CEO)
>
> What am I not understanding here?

Something else must be going on. I've just tried to replicate your
situation, and had no problems:

[ccox@ccox-shiny:~]% cat test.m
#import <Foundation/Foundation.h>


int main() {
    NSString    *thePhrase  = @"Geschäftsführer (CEO):";
    NSString    *tString    = @"Geschäftsführer (CEO)";

    NSRange     range       = [thePhrase rangeOfString: tString
options: NSCaseInsensitiveSearch];

    NSLog(@"thePhrase   = \"%@\"", thePhrase);
    NSLog(@"tString     = \"%@\"", tString);
    NSLog(@"range       = %@", NSStringFromRange(range));

    return 0;
}
[ccox@ccox-shiny:~]% cc test.m -framework Foundation -fobjc-gc && ./a.out
2009-10-04 14:17:04.981 a.out[7705:903] thePhrase   = "Geschäftsführer (CEO):"
2009-10-04 14:17:04.983 a.out[7705:903] tString     = "Geschäftsführer (CEO)"
2009-10-04 14:17:04.983 a.out[7705:903] range       = {0, 21}




--
Clark S. Cox III
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

  • Follow-Ups:
    • Re: rangeOfString & UTF8 - SOLVED
      • From: Steve Cronin <email@hidden>
References: 
 >rangeOfString & UTF8 (From: Steve Cronin <email@hidden>)

  • Prev by Date: rangeOfString & UTF8
  • Next by Date: Re: Checking whether a file is a genuine PDF file
  • Previous by thread: rangeOfString & UTF8
  • Next by thread: Re: rangeOfString & UTF8 - SOLVED
  • Index(es):
    • Date
    • Thread