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