Re: Relative URLs, and string encodings
Re: Relative URLs, and string encodings
- Subject: Re: Relative URLs, and string encodings
- From: Jens Alfke <email@hidden>
- Date: Thu, 1 Jun 2017 09:25:57 -0700
> On Jun 1, 2017, at 7:44 AM, Jonathan Taylor <email@hidden> wrote:
>
> My attempt like:
> [NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding] relativeToURL:relativeTo];
Ah, you want NSUTF8StringEncoding instead. Generally speaking, URL encoding always uses UTF-8 nowadays.
> This had been working ok for some time, but I have just found it to be broken for filenames containing unusual characters. In particular, it fails when given a filename containing a “smart quote” (not easily created directly with the keyboard, but auto-generated as part of a time machine backup, based on the machine name).
You mean an open or close (aka “curly”) quote? They’re easily typed with Option-[ and Option-Shift-[.
—Jens
(Small typographic rant: These are the true quotation marks. The “straight” one was a shortcut invented for the typewriter, to save an extra key, and should never be used in print.)
_______________________________________________
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