• 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: NSURL getResourceValue fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURL getResourceValue fails


  • Subject: Re: NSURL getResourceValue fails
  • From: Steve Gehrman <email@hidden>
  • Date: Wed, 13 Oct 2010 20:08:12 -0700

I tried to get it working, but it's still failing.  I don't really know much about this stuff, but I do see it changing the encoding.

The name comes in as "matéo" and is converted to "matéo" Does that look right?

The new url does convert back to "matéo", so it must be valid.

Any ideas?

Thanks,

-steve

2010-10-13 19:56:20.872 Path Finder[76353:9d03] start URL: file://localhost/Volumes/ftp.ftpwt.com/matéo/
2010-10-13 19:56:20.872 Path Finder[76353:9d03] start path: /Volumes/ftp.ftpwt.com/matéo
2010-10-13 19:56:20.872 Path Finder[76353:9d03] new URL: file://localhost/Volumes/ftp.ftpwt.com/matéo
2010-10-13 19:56:20.872 Path Finder[76353:9d03] converted back: file://localhost/Volumes/ftp.ftpwt.com/matéo

2010-10-13 20:00:55.789 Path Finder[76353:9d03] resourceForKey:, key: NSURLNameKey, error: Error Domain=NSCocoaErrorDomain Code=260 UserInfo=0x125218a20 "The file “matéo” couldn’t be opened because there is no such file." Underlying Error=(Error Domain=NSPOSIXErrorDomain Code=2 UserInfo=0x128b1db90 "The operation couldn’t be completed. No such file or directory")


NSURL* theURL = [self cachedURL:YES];


NSString* thePath = [theURL path];


NSLog(@"start URL: %@", theURL);


NSLog(@"start path: %@", thePath);


thePath = CFStringCreateWithFileSystemRepresentation(NULL, [thePath fileSystemRepresentation]);


theURL = [NSURL fileURLWithPath:thePath];


NSLog(@"new URL: %@", theURL);


                // converting back just to verify we get the same string back

thePath = [[theURL absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSLog(@"converted back: %@", thePath);


error = nil;
result = [theURL resourceForKey:resourceKey error:&error];



On Oct 13, 2010, at 2:31 PM, Dominic Giampaolo wrote:

and the problem doesn't happen on a normal hard disk and most servers work fine, just this one ftp volume mounted.

It's still a question of decomposed vs. precomposed
utf-8 characters.  If the server gives you back
precomposed but the string does get decomposed then
it won't work.  Sadly this is a grey area which has
never been fully addressed because there are no
clear solutions except "everyone should behave the
same".  And that solution as you might imagine is
never going to happen in the computer industry.

Probably the easiest thing to do is to always try
the normal route but if you get back "not found"
_and_ the string has non-ascii characters, then
try it as precomposed and see if that finds the
item.


--dominic



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >File Corruption copying to a DMG (From: Steve Gehrman <email@hidden>)
 >Re: File Corruption copying to a DMG (From: Eric Tamura <email@hidden>)
 >Re: File Corruption copying to a DMG (From: Steve Gehrman <email@hidden>)
 >Re: File Corruption copying to a DMG (From: Dave Camp <email@hidden>)
 >Re: File Corruption copying to a DMG (From: Steve Gehrman <email@hidden>)
 >NSURL getResourceValue fails (From: Steve Gehrman <email@hidden>)
 >Re: NSURL getResourceValue fails (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Re: NSURL getResourceValue fails
  • Next by Date: Meta Data?
  • Previous by thread: Re: NSURL getResourceValue fails
  • Next by thread: Meta Data?
  • Index(es):
    • Date
    • Thread