• 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: Cocoa-dev Digest, Vol 2, Issue 21
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Cocoa-dev Digest, Vol 2, Issue 21


  • Subject: RE: Cocoa-dev Digest, Vol 2, Issue 21
  • From: "Simon alias Trax" <email@hidden>
  • Date: Thu, 06 Jan 2005 02:50:28 +0000


Here's a real-life example :

NSString *mot1 = @"arc";
NSString *mot2 = @"a";
NSString *mot3 = @"à";

Unless things have changed recently, GCC isn't UTF-8 aware and may be doing strange things to your text. Try reading your strings in from a file or from the UI and try again.

I think (mostly) everyone here is missing the point.  The accented "a", also known as U+0030, does not compare before the word "arc" as it should (especially since it compares equal to a non-accented "a").  The original poster had a legitimate problem which had nothing to do with file encodings but that seems to be all everyone is talking about.  The question is, is it a bug that the accented "a" compares after the word "arc" or is it a misunderstanding?

Brendan Younger

That's quite possible. Anyway, if it's the case, I will explain a little more...


My array of strings is created like this :

dict = [[NSArray alloc] initWithArray:[[NSString stringWithContentsOfFile:fich] componentsSeparatedByString:@"\r"]];

In the process, another array is created with strings taken from that big array, and then sorted. I tried with a little array (3 element, see top of the page for code snippet), and I get it wrong. My case is French, and I think it's not like Swedish (like å). In French, accented letters are seen as equivalent to their non-accented counterparts, but IF a word is an homophone except for its accented letter(s), then it comes after. Here's another example I tried within my app and still don't work :

mur
mûr
muse

This is correct alphabetical order. BUT, sortUsingSelector:@selector(compare:) gives me this :

mur
muse
mûr

Since "u" is supposed to be like "û", "s" comes after "r", but not in this case. Same with sortUsingSelector:@selector(localizedCompare:). The computer thinks as if "à" (or any other accented letter) is a completely different letter and likely comes after "z". But that's not the case, at least in French. (Unlike Swedish, for example, where "å" comes after "z"...


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Cocoa-dev Digest, Vol 2, Issue 21
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: [OT] user banned from the list
  • Next by Date: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Previous by thread: Re: [SOLVED] Re: calling Java for ObjC
  • Next by thread: Re: Cocoa-dev Digest, Vol 2, Issue 21
  • Index(es):
    • Date
    • Thread