http://en.wikipedia.org/wiki/Percent-encoding
| 107 | |
| 108 | // http://en.wikipedia.org/wiki/Percent-encoding |
| 109 | static bool IsUnreserved(char c) |
| 110 | { |
| 111 | if (c >= 'a' && c <= 'z') { |
| 112 | return true; |
| 113 | } else if (c >= 'A' && c <= 'Z') { |
| 114 | return true; |
| 115 | } else if (c >= '0' && c <= '9') { |
| 116 | return true; |
| 117 | } else { |
| 118 | switch (c) { |
| 119 | case '-': |
| 120 | case '_': |
| 121 | case '.': |
| 122 | case '~': |
| 123 | case '/': |
| 124 | return true; |
| 125 | } |
| 126 | } |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | Result Encode(const char* src, char* dst, uint32_t dst_len, uint32_t* bytes_written) |
| 131 | { |