Re: Converting filenames to file: URIs

Al Gilman wrote:
> 
> At 1:40 PM +0100 5/12/05, Graham Klyne wrote:
> >
> >What's missing here?  How does this stand up on a Mac platform?
> 
> There is a laundry list Mike Brown contributed last year,
> in response to a similar question from you.
> 
> http://lists.w3.org/Archives/Public/uri/2004Jul/0013
> 
> [notably the UNC addressing of networked storage.]

...and where the Windows drivespec should go (sometimes it makes sense to put 
it in the path of the URI, other times in the authority), and whether it
should be retained at all...

...and character encoding issues, although I guess if you're accepting only a 
Java String object, such issues are beyond the scope of your function.

My implementation for Python is at 
http://cvs.4suite.org/viewcvs/4Suite/Ft/Lib/Uri.py?view=markup (scroll down to 
def OsPathToUri) and it doesn't even bother trying to deal with encoding (if 
given a byte string, it is assumed to be in an ASCII-compatible encoding, and 
any non-unreserved characters/bytes are percent-encoded as-is; if given a 
unicode string, UTF-8 is used as the basis for percent-encoding). I do allow for 
the caller to select the encoding on the return-trip, though, in UriToOsPath().

-Mike

Received on Thursday, 12 May 2005 16:12:30 UTC