![]() |
Functions | |
Q_ENTRY * | qParseQueries (Q_ENTRY *entry, const char *query, char equalchar, char sepchar, int *count) |
Parse URL encoded query string. | |
char * | qUrlEncode (const void *bin, size_t size) |
Encode data using URL encoding(Percent encoding) algorithm. | |
size_t | qUrlDecode (char *str) |
Decode URL encoded string. | |
char * | qBase64Encode (const void *bin, size_t size) |
Encode data using BASE64 algorithm. | |
size_t | qBase64Decode (char *str) |
Decode BASE64 encoded string. | |
char * | qHexEncode (const void *bin, size_t size) |
Encode data to Hexadecimal digit format. | |
size_t | qHexDecode (char *str) |
Decode Hexadecimal encoded data. |
Q_ENTRY* qParseQueries | ( | Q_ENTRY * | entry, | |
const char * | query, | |||
char | equalchar, | |||
char | sepchar, | |||
int * | count | |||
) |
Parse URL encoded query string.
entry | a pointer of Q_ENTRY structure. NULL can be used. | |
query | URL encoded string. | |
equalchar | separater of key, value pair. | |
sepchar | separater of line. | |
count | if count is not NULL, a number of parsed entries are stored. |
cont char query = "category=love&str=%C5%A5%B5%F0%C4%DA%B4%F5&sort=asc"; Q_ENTRY *entry = qDecodeQueryString(NULL, req->pszQueryString, '=', '&', NULL); printf("category = %s\n", entry->getStr(entry, "category")); printf("str = %s\n", entry->getStr(entry, "str")); printf("sort = %s\n", entry->getStr(entry, "sort")); entry->free(entry);
char* qUrlEncode | ( | const void * | bin, | |
size_t | size | |||
) |
Encode data using URL encoding(Percent encoding) algorithm.
bin | a pointer of input data. | |
size | the length of input data. |
const char *text = "hello 'qDecoder' world"; char *encstr = qUrlEncode(text, strlen(text)); if(encstr == NULL) return -1; printf("Original: %s\n", text); printf("Encoded : %s\n", encstr); size_t decsize = qUrlDecode(encstr); printf("Decoded : %s (%zu bytes)\n", encstr, decsize); free(encstr); --[output]-- Original: hello 'qDecoder' world Encoded: hello%20%27qDecoder%27%20world Decoded: hello 'qDecoder' world (22 bytes)
size_t qUrlDecode | ( | char * | str | ) |
Decode URL encoded string.
str | a pointer of URL encoded string. |
char* qBase64Encode | ( | const void * | bin, | |
size_t | size | |||
) |
Encode data using BASE64 algorithm.
bin | a pointer of input data. | |
size | the length of input data. |
const char *text = "hello 'qDecoder' world"; char *encstr = qBase64Encode(text, strlen(text)); if(encstr == NULL) return -1; printf("Original: %s\n", text); printf("Encoded : %s\n", encstr); size_t decsize = qBase64Decode(encstr); printf("Decoded : %s (%zu bytes)\n", encstr, decsize); free(encstr); --[output]-- Original: hello 'qDecoder' world Encoded: aGVsbG8gJ3FEZWNvZGVyJyB3b3JsZA== Decoded: hello 'qDecoder' world (22 bytes)
size_t qBase64Decode | ( | char * | str | ) |
Decode BASE64 encoded string.
str | a pointer of Base64 encoded string. |
char* qHexEncode | ( | const void * | bin, | |
size_t | size | |||
) |
Encode data to Hexadecimal digit format.
bin | a pointer of input data. | |
size | the length of input data. |
const char *text = "hello 'qDecoder' world"; char *encstr = qHexEncode(text, strlen(text)); if(encstr == NULL) return -1; printf("Original: %s\n", text); printf("Encoded : %s\n", encstr); size_t decsize = qHexDecode(encstr); printf("Decoded : %s (%zu bytes)\n", encstr, decsize); free(encstr); return 0; --[output]-- Original: hello 'qDecoder' world Encoded : 68656c6c6f2027714465636f6465722720776f726c64 Decoded : hello 'qDecoder' world (22 bytes)
size_t qHexDecode | ( | char * | str | ) |
Decode Hexadecimal encoded data.
str | a pointer of Hexadecimal encoded string. |