summaryrefslogtreecommitdiffabout
path: root/src/util.cc
Side-by-side diff
Diffstat (limited to 'src/util.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.cc b/src/util.cc
index 2e2d305..3166e62 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -4,17 +4,17 @@
namespace kingate {
static const char *safeChars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"_-" ;
- string url_escape(const string& str) {
+ string url_encode(const string& str) {
string rv = str;
string::size_type screwed = 0;
for(;;) {
screwed = rv.find_first_not_of(safeChars,screwed);
if(screwed == string::npos)
break;
while(screwed<rv.length() && !strchr(safeChars,rv.at(screwed))) {
char danger = rv.at(screwed);
@@ -25,17 +25,17 @@ namespace kingate {
snprintf(&tmp[1],3,"%02X",0xFF&(int)danger);
rv.replace(screwed,1,tmp,3);
screwed+=3;
}
}
}
return rv;
}
- string url_unescape(const string& str) {
+ string url_decode(const string& str) {
string rv = str;
string::size_type unscrewed = 0;
for(;;) {
unscrewed = rv.find_first_of("%+",unscrewed);
if(unscrewed == string::npos)
break;
if(rv.at(unscrewed)=='+') {
rv.replace(unscrewed++,1,1,' ');