Fix spaces and non-ASCII characters failing to convert to NSURL.
Add tests.