A tiny library for decode value of the query string using c with utf8 support and html entities.
decodeUrl(destination,source);
decodeHtmlEntities(destination,source);voiddecodeUrl(char*destination,constchar*source);
size_tdecodeHtmlEntities(char*destination,constchar*source);
// char *urlDecode(const char *str);// static inline char toUpper(char c);staticintparseEntity(constchar*current,char**to,constchar**from);
staticsize_tputUtf8Char(unsigned longvalue,char*buffer);
staticconstchar*getNamedEntity(constchar*name);
staticintstringCompare(constvoid*key,constvoid*value);// const char asciiHex[23] = {...};staticconstchar*constNamedEntities[][2] = {...};#include<stdio.h>#include<stdlib.h>#include<string.h>#include<ctype.h>#include<errno.h>Input: %D8%B3%D9%84%D8%A7%D9%85
Output: سلام
Input: HELLO%2C+%26%231587%3B%26%231604%3B%26%231575%3B%26%231605%3B+%2C+%26%231777%3B%26%231778%3B%26%231779%3B
Output: HELLO, سلام , ۱۲۳
$ git clone https://github.com/BaseMax/DecodeQueryStringC
$ cd DecodeQueryStringC/
$ cd example/
$ gcc main.c ../source/decodequery.c -o main
$ ./main
Many resources have been used to implement this library. (Eg NamedEntities, ...)
Also, some of the code has been follow from certain libraries.
So, if you use this complete library, keep the author's name.
In addition, parts of the code have also been optimized. If you have any suggestions for improvement or correction, you can submit.
Thank You.