Jason Dillon wrote:

String configFromSomewhere = ....
File file = new File(new URI(URLEncoder(configFromSomewhere));


Can you actually read a file using this?


what i just did not read while using the URLEncoder class is that it is meant to encode HTML form field values which will be passed to a CGI etc..

that means it will not encode complete URLs. this is the
reason why the protocol (file:///) part gets for example
encoded to

 -> file%3A%2F%2F%2F

and finally according to the doc a whitespace gets
converted to a plus sign but according RFC 2396 you
will need a %20 escape sequence.

so i am wondering how the string 'configFromSomewhere'
gets encoded accordingly if it contains the protocol
part of an URL or whitespaces.

regards

daniel s. haischt
--




Reply via email to