35 |
// and http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_266 ) |
// and http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_266 ) |
36 |
std::string result; |
std::string result; |
37 |
for (int iElement = 0; iElement < elements.size(); iElement++) { |
for (int iElement = 0; iElement < elements.size(); iElement++) { |
38 |
// encode forward slashes |
// encode percent characters |
39 |
std::string e = elements[iElement]; |
std::string e = elements[iElement]; |
40 |
for ( |
for ( |
41 |
|
int pos = e.find("%"); pos != std::string::npos; |
42 |
|
pos = e.find("%", pos+2) |
43 |
|
) e.replace(pos/*offset*/, 1/*length*/, "%%"/*by*/); |
44 |
|
// encode forward slashes |
45 |
|
for ( |
46 |
int pos = e.find("/"); pos != std::string::npos; |
int pos = e.find("/"); pos != std::string::npos; |
47 |
pos = e.find("/", pos+1) |
pos = e.find("/", pos+3) |
48 |
) e.replace(pos/*offset*/, 1/*length*/, "%2f"/*by*/); |
) e.replace(pos/*offset*/, 1/*length*/, "%2f"/*by*/); |
49 |
// append encoded node to full encoded path |
// append encoded node to full encoded path |
50 |
result += "/" + e; |
result += "/" + e; |