String UrlEncode(String s) { const char *p = s, *e = s.End(); String out; for(; p < e; p++) { const char *b = p; while(p < e && (byte)*p > ' ' && (byte)*p < 127 && (IsAlNum(*p) || *p == ',' || *p == '.' || *p == '-' || *p == '_')) p++; if(p > b) out.Cat(b, int(p - b)); if(p >= e) break; if(*p == ' ') out << '+'; else out << '%' << hex_digits[(*p >> 4) & 15] << hex_digits[*p & 15]; } return out; }
Report message to a moderator