Wouldn't it be better to just use:
```
vector<string> segments = StringUtils::Split(strPath, '/');
for (vector<string>::iterator i = segments.begin(); i != segments.end(); ++i)
  *i = CURL::Encode(*i);
return StringUtils::Join(segments, '/');
```