On Feb 12, 2006, at 22:15, David A. G. wrote:

> The URL must be encoded because may have illegal characters:
>
> The user may enter an URL like:
> http://www.site.com/fol 1/fol 2/file 1.jpg?par=sdf|dfgó.jpg
>
> This URL must be encoded as:
> http://www.site.com/fol%201/fol%202/file%201.jpg?par=sdf%7Cdfg%F3.jpg

Yes, but you are assuming that non-encodable characters are part of the 
URL; what if they were not?  What if the value of "par" contained an 
ampersand symbol, a slash, an equal sign, or a question mark?  Since 
you cannot tell which parts need to be encoded, you must use UrlEncode 
individually on the parts that require it, and concatenate them with 
the valid characters as in my example.

> This kind of codification must be "parse-sensitive", because an URL 
> cannot
> be completely encoded without taking care of Protocol, Address, Port,
> Folders, File and Parameters (..and Authentication and Bookmark
> information).

Again, you are assuming that it is straight-forward.  The atoms for the 
server part are predictable: protocol, FQDN, port, path, filename, but 
anything after that is not, which is the reason why escaping is 
necessary, because valid delimiters can be part of parameter names or 
values.

        dZ.
-- 
        DZ-Jay [TeamICS]
        http://www.overbyte.be/eng/overbyte/teamics.html

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to