Ensure resource is directory checking handles encoding

Fixes #2889

Switched to using platform dependent conversions for URL -> File (ie,
the File(URI) constructor), and added tests for various permutations of
spaces in resources.