[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: URI escaping in repository URLs

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-03-31 14:39:45 CEST

"C. Michael Pilato" <cmpilato@collab.net> writes:

> "Stephen Warren" <swarren@paramanet.com> writes:
>
>> However, can't you allow the user to specify whether the URI is
>> encoded or not - and if the user marks it as not encoded, then apply
>> encoding where required to make it a valid URI?
>
> I suppose that could be done. Perhaps some logic like this:
>
> if definitely_not_valid_url(URL):
> URL = uri_encode(URL)
> elif URL.contains('%25'):
> if not "--force_url":
> error("Can't tell if your URL is encoded or not")
> do_action(URL)

It's possible we could do something, but not exactly the above. I
think "escape" is a better term than "encode", since there is a
separate UTF-8 encoding problem. Overall, we have to handle

1. easy things that don't change

       user: http://example.com/foobar
    escaped: http://example.com/foobar

2. easy things that do change

       user: http://example.com/foo bar
    escaped: http://example.com/foo%20bar

3. ambiguous things like

       user: http://example.com/foo%20bar
    escaped: http://example.com/foo%20bar
      or
    escaped: http://example.com/foo%25%20bar

4. dubious things like

       user: http://example.com/foo%20bar/zig zag
    escaped: http://example.com/foo%25%20bar/zig%20zag
       or
    escaped: http://example.com/foo%20bar/zig%20zag

5. things that are invalid UTF-8

       user: http://example.com/foo%e5bar
    escaped: http://example.com/foo%E5bar

6. ambiguous things that could be invalid UTF-8

       user: http://example.com/foo%E5bar
    escaped: http://example.com/foo%E5bar
       or
    escaped: http://example.com/foo%25E5bar

Note: once escaping is determined the UTF-8 thing (cases 5 and 6) is
easy to handle, simply unescape the URL and if the result is not valid
UTF-8 then generate an error. It could be fixed right now since we
implicitly assume that URLs are already escaped.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Mar 31 14:40:23 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.