W3C home > Mailing lists > Public > uri@w3.org > May 2005

Re: Converting filenames to file: URIs

From: Mike Brown <mike@skew.org>
Date: Thu, 12 May 2005 10:12:25 -0600 (MDT)
Message-Id: <200505121612.j4CGCPj8085789@chilled.skew.org>
To: uri@w3.org

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().

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:09 UTC