7 #include "libwfut/Encoder.h" 9 #define snprintf _snprintf 16 for (
size_t i = 0; i < str.size(); ++i) {
19 if ((c >=
'a' && c <=
'z')
20 || (c >=
'A' && c <=
'Z')
21 || (c >=
'0' && c <=
'9') ) {
24 }
else if (c ==
'-' || c ==
'_' || c ==
'.' || c ==
'*') {
27 }
else if (c ==
' ') {
33 snprintf(buf, 4,
"%%%2.2X", c);
44 for (
size_t i = 0; i < str.size(); ++i) {
47 const char *buf = &str.c_str()[i];
49 sscanf(buf,
"%%%2x", &u);
52 }
else if (c ==
'+') {
65 for (
size_t i = 0; i < str.size(); ++i) {
68 if ((c >=
'a' && c <=
'z')
69 || (c >=
'A' && c <=
'Z')
70 || (c >=
'0' && c <=
'9') ) {
73 }
else if (c ==
'-' || c ==
'_' || c ==
'.' || c ==
'|' || c ==
'~' || c ==
'*' || c ==
'\'' || c ==
'(' || c ==
')') {
76 }
else if (c ==
';' || c ==
'/' || c ==
'?' || c ==
':' || c ==
'@' || c ==
'&' || c ==
'=' || c ==
'+' || c ==
'$' || c ==
',') {
82 snprintf(buf, 4,
"%%%2.2X", c);
static std::string encodeURL(const std::string &str)
static std::string encodeString(const std::string &str)
static std::string decodeString(const std::string &str)