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