GithubHelp home page GithubHelp logo

basemax / decodequerystringc Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 9.0 60 KB

A tiny library for decode value of the query string using c with utf8 support and html entities.

License: GNU General Public License v3.0

C 100.00%
decode-urls decode decode-strings decoder decoders decode-form querystring querystrings urldecode htmlentities url-parser parser parser-library parsers parser-plugin c

decodequerystringc's Introduction

Decode Query String Using C

A tiny library for decode value of the query string using c with utf8 support and html entities.

Using

decodeUrl(destination,source);
decodeHtmlEntities(destination,source);

Functions

void decodeUrl(char *destination,const char *source);
size_t decodeHtmlEntities(char *destination,const char *source);
// char *urlDecode(const char *str);
// static inline char toUpper(char c);
static int parseEntity(const char *current,char **to,const char **from);
static size_t putUtf8Char(unsigned long value,char *buffer);
static const char *getNamedEntity(const char *name);
static int stringCompare(const void *key,const void *value);

Global Variable

// const char asciiHex[23] = {...};
static const char *const NamedEntities[][2] = {...};

Includes

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>

Example I/O

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, سلام , ۱۲۳

Compile Example

$ git clone https://github.com/BaseMax/DecodeQueryStringC
$ cd DecodeQueryStringC/
$ cd example/
$ gcc main.c ../source/decodequery.c -o main
$ ./main

Copyright

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.

decodequerystringc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

decodequerystringc's Issues

No CMakeLists.txt

Hello, thank you for sharing your project!
However I think it should contain CMakeLists.txt in order for it to be easier to integrate into other projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.