On 6/21/11 12:27 , Mark Evenson wrote:
The rules adopted for URI encoding are
All pathname components are represented "as is" without escaping.
Namestrings are suitably escaped if the Pathname is a URL-PATHNAME
or a JAR-PATHNAME.
[…]
Alan asked me to include some docstrings for this behavior, so in writing them up I discovered two points that need clarification.
a) For URL-PATHNAME the directory components are stored with the URI escaping, contradicting the first rule
(pathname-directory #p"http://example.org/bar%20with%20space/there") ==> (:ABSOLUTE "bar%20with%20space")
b) For a JAR-PATHNAME the DIRECTORY-NAMESTRING returns an unescaped string:
(directory-namestring #p"jar:file:foo.jar!/a%20spaced%20directory/bar.lisp") ==> "/a spaced directory/"
It might be nice to allow behavior a) to stand with the reasoning that the typical usage might be to splice up URI paths but in the end the result would be reconstituted as a URL-PATHNAME, but this contradicts the simplicity of rule #1.
But I think behavior b) should be fixed to emit the uri encoded representation. If the user wishes to take components from a URL-PATHNAME to refer to files on the local filesystem with #\Space instead of %20, she would need to explicitly specify such a transformation.
Thoughts? I hope this isn't the tip of another iceberg…