From ff4b919683537625f693eedf53006364d0f8444d Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 29 Jan 2005 20:14:37 +0000 Subject: initial commit into repository --- (limited to 'src/util.cc') diff --git a/src/util.cc b/src/util.cc new file mode 100644 index 0000000..2e2d305 --- a/dev/null +++ b/src/util.cc @@ -0,0 +1,53 @@ +#include "kingate/util.h" +#include "kingate/exception.h" + +namespace kingate { + + static const char *safeChars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "_-" ; + + string url_escape(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