File URI on Windows

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

File URI on Windows

Ron Teitelbaum
Hi All,

I just ran into an error with 
    FileDirectory >> uri
and saw this commit comment.  

>>> Network-fbs.102 <<<
Fix TestURI>>testDirWithHash. Given that FileDirectory>>uri had "encodeForHTTP" commented out, 
I'd appreciate extra pair of eyes on this change. If there are good reasons not to URI-encode 
the path bits, please add a comment explaining why!
HTTP encoding of the drive letter colon on Windows breaks uri's and other http encoded characters or even an encoded space also fail if you use the uri path to do something like retrieving files.  It seems to me the FileDirectory class >> pathFromURI: should return something that works with FileDirectory class >> on: 

Our code does this: 

(FileDirectory on: (FileDirectory default pathFromURI: aPathName ))

I started doing some research and windows seems to require UTF-16 for file names.  I saw convertToSystemString which I thought might actually be the right answer but it only does UTF8 which is wrong.  

the two possible solutions are that I change my code to do 
(FileDirectory on: (FileDirectory default pathFromURI: aPathName ) unescapePercents)

or we remove the encodeForHTTP and put it back the way it was on
FileDirectory >> uri

I'll also note that FileURL >> pathString also does encodeForHTTP which I think is correct since you are looking for a URL not a FileDirectory and would expect HTTP encoding.


All the best,

Ron Teitelbaum