File tree Expand file tree Collapse file tree 1 file changed +46
-1
lines changed Expand file tree Collapse file tree 1 file changed +46
-1
lines changed Original file line number Diff line number Diff line change 11lua-url-encode
22==
33
4- A URL encoder/decoder library for lua.
4+ A URL encoder/decoder library for lua with native extension.
5+
6+ This library aims to use within ` application/x-www-form-urlencoded ` .
7+
8+ Synopsis
9+ --
10+
11+ ``` lua
12+ local urlencode = require ' urlencode'
13+
14+ urlencode .encode_url (" hello こんにちは" ) -- => hello+%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF
15+ urlencode .decode_url (" hello+%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF" ) -- => hello こんにちは
16+ ```
17+
18+ Functions
19+ --
20+
21+ ### ` encode_url(str) `
22+
23+ This function encodes the string as URL encoding. The string ** MUST** be utf8.
24+
25+ ### ` decode_url(str) `
26+
27+ This function decodes the string as URL encoding. The string ** MUST** be utf8.
28+
29+ Disclaimer
30+ --
31+
32+ This library only works certainly with utf8 string.
33+
34+ Benchmark
35+ --
36+
37+ Benchmark code is [ here] ( ./benchmark/bench.lua ) :
38+
39+ ```
40+ pure lua: encode url system: 15.360 user: 0.100 total: 15.460 real: 16.125
41+ encodeurl: encode url system: 0.240 user: 0.040 total: 0.280 real: 0.312
42+ pure lua: decode url system: 10.160 user: 0.060 total: 10.220 real: 10.625
43+ encodeurl: decode url system: 0.260 user: 0.040 total: 0.300 real: 0.375
44+ ```
45+
46+ Original code
47+ --
48+
49+ This library takes lots of code from [ p5-url-encode-xs] ( https://github.com/chansen/p5-url-encode-xs ) .
550
651License
752--
You can’t perform that action at this time.
0 commit comments