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

Re: [TSVN] Merge problem

From: Olaf van der Spek <OvdSpek_at_LIACS.NL>
Date: 2004-08-09 18:33:57 CEST

SteveKing wrote:
>> To improve auto-escaping, you could escape any illegal character
>> (except '%').
>
>
> Want to submit a patch for that? Check out the methods
> IsEscaped() and PathEscape() in the Utils.cpp in the TortoiseProc folder.

BTW, if (path.Find("%%5E")>=0) doesn't look right in your version.

This is the function I'm using (except for the % exception):
static string hex_encode(int l, int v)
{
        string r;
        r.resize(l);
        while (l--)
        {
                r[l] = "0123456789abcdef"[v & 0xf];
                v >>= 4;
        }
        return r;
};

string uri_encode(const string& v)
{
        string r;
        r.reserve(v.length());
        for (int i = 0; i < v.length(); i++)
        {
                char c = v[i];
                if (isalpha(c) || isdigit(c))
                        r += c;
                else
                {
                        switch (c)
                        {
                        case ' ':
                                r += '+';
                                break;
                        case '%':
                        case ',':
                        case '-':
                        case '.':
                        case '@':
                        case '_':
                                r += c;
                                break;
                        default:
                                r += "%" + hex_encode(2, c);
                        }
                }
        }
        return r;
};

It's with std::string instead of CString, but that should be easy to modify.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Mon Aug 9 19:42:23 2004

This is an archived mail posted to the TortoiseSVN Dev mailing list.

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