https://github.com/jwerle/uri.c
URI Component encoder/decoder
https://github.com/jwerle/uri.c
Last synced: 11 months ago
JSON representation
URI Component encoder/decoder
- Host: GitHub
- URL: https://github.com/jwerle/uri.c
- Owner: jwerle
- License: mit
- Created: 2014-06-01T17:12:09.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-28T16:16:39.000Z (over 11 years ago)
- Last Synced: 2025-04-22T22:34:57.021Z (about 1 year ago)
- Language: C
- Size: 198 KB
- Stars: 24
- Watchers: 19
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
uri.c
=====
URI Component encoder/decoder
## install
```sh
$ clib install littlstar/uri.c
```
## usage
```c
#include
```
```c
#include
#include
#include "uri.h"
int
main (void) {
char *enc = NULL;
char *dec = NULL;
enc = uri_encode("Betty's favorite language is Français");
printf("%s\n", enc); // Betty%27s%20favorite%20language%20is%20Fran%C3%A7ais
dec = uri_decode(enc);
printf("%s\n", dec); // Betty's favorite language is Français
return 0;
}
```
## api
Encodes a URI component by replacing each
instance of certain characters by one, two, three, or four escape
sequences representing the UTF-8 encoding of the character
```c
char *
uri_encode (const char *);
```
Decodes a URI component source from `uri_encode`
```c
char *
uri_decode (const char *);
```
## license
MIT