We do need escaping of spaces otherwise path.toURI() will barf when the
path contains spaces.