Adds support to urlEncode transformation

This commit is contained in:
Felipe Zimmerle
2015-10-22 20:47:02 -03:00
parent e3e8bac138
commit 91d29d2849
5 changed files with 75 additions and 11 deletions

View File

@@ -842,6 +842,17 @@ unsigned char x2c(unsigned char *what) {
}
unsigned char *c2x(unsigned what, unsigned char *where) {
static const char c2x_table[] = "0123456789abcdef";
what = what & 0xff;
*where++ = c2x_table[what >> 4];
*where++ = c2x_table[what & 0x0f];
return where;
}
std::string string_to_hex(const std::string& input) {
static const char* const lut = "0123456789ABCDEF";
size_t len = input.length();