• 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: completePathIntoString doesn't work with unicode paths??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completePathIntoString doesn't work with unicode paths??


  • Subject: Re: completePathIntoString doesn't work with unicode paths??
  • From: Jonathan del Strother <email@hidden>
  • Date: Fri, 3 Jun 2005 03:02:58 +0100


On 3 Jun 2005, at 02:31, Bob Ippolito wrote:


On Jun 2, 2005, at 6:28 PM, Jonathan del Strother wrote:


I'm struggling with NSString & some Unicode pathnames.  My worst-case scenario test file is something called "Artist-SigurRós,Album-()和紙.tiff"

I'm constructing the full path of that file without the extension, then using "completePathIntoString" to get all the files that start with "Artist-SigurRós,Album-()和紙".  It tells me there are no matches - I know there are two.

However, if I strip down the filename even further, to "Artist-SigurR", then use completePathIntoString, it works fine.

Is this a bug, or am I missing some Unicode subtlety that I need to fix somewhere?


Sounds like a bug to me, but you should probably post some example code that reproduces this problem because you might be doing something else strangely.



Thanks for the reply.  On further testing, there might be something wrong with the source string, but I'm still not quite sure.


I created a test file called /UnicodeÜberTest.txt, then try and find matches for the full name, the shortened non-unicode name, and then try and match the result of that 2nd op. again.


    NSString* fullPath = @"/UnicodeÜberTest";
    NSString* shortPath = @"/Unicode";

    

    NSString* longestMatch;
    NSArray* matches;
    int numMatches;

    

    numMatches = [fullPath completePathIntoString:&longestMatch caseSensitive:NO matchesIntoArray:&matches filterTypes:nil];
    NSLog(@"%d matches for %@", numMatches, fullPath);

    

    numMatches = [shortPath completePathIntoString:&longestMatch caseSensitive:NO matchesIntoArray:&matches filterTypes:nil];
    NSLog(@"%d matches for %@", numMatches, shortPath);

        

    NSString* longestMatch2;
    numMatches = [longestMatch completePathIntoString:&longestMatch2 caseSensitive:NO matchesIntoArray:&matches filterTypes:nil];
    NSLog(@"%d matches for %@", numMatches, longestMatch);

Resulting in :

0 matches for /UnicodeÜberTest
1 matches for /Unicode
1 matches for /UnicodeÜberTest.txt


Of course, the first result is a little dodgy - IIRC having that non-ascii character in the source code isn't supported.   The fact that the last result works suggests that completePathIntoString will work in some cases, at least...




Which kinda casts doubt on how I'm getting the name of my worst-case file to begin with.
It's constructed from the iTunes XML file, loaded as an NSDictionary and with values accessed via objectForKey.  These are then stripped of spaces and joined with the rest of the path name to get the full path.  And it *appears* to be constructed fine : if I NSLog the path, it has all the right characters.  I can even cut & paste the path from the log window to Terminal and do stuff with the file that way.   But it fails for things like completePathIntoString...


Any other thoughts on things I might try?
Thanks,
Jon
 _______________________________________________
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

References: 
 >completePathIntoString doesn't work with unicode paths?? (From: Jonathan del Strother <email@hidden>)
 >Re: completePathIntoString doesn't work with unicode paths?? (From: Bob Ippolito <email@hidden>)

  • Prev by Date: Re: completePathIntoString doesn't work with unicode paths??
  • Next by Date: Re: completePathIntoString doesn't work with unicode paths??
  • Previous by thread: Re: completePathIntoString doesn't work with unicode paths??
  • Next by thread: Re: completePathIntoString doesn't work with unicode paths??
  • Index(es):
    • Date
    • Thread