Software /
code /
prosody
Comparison
util/datamanager.lua @ 628:3712d36b6d25
Fixed URL encoding to generate %0x instead of %x
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 16 Dec 2008 03:46:17 +0500 |
parent | 615:4ae3e81513f3 |
child | 643:8ff454831f7d |
comparison
equal
deleted
inserted
replaced
621:cd2cab5400fc | 628:3712d36b6d25 |
---|---|
42 decode = function (s) | 42 decode = function (s) |
43 return s and (s:gsub("+", " "):gsub("%%([a-fA-F0-9][a-fA-F0-9])", urlcodes)); | 43 return s and (s:gsub("+", " "):gsub("%%([a-fA-F0-9][a-fA-F0-9])", urlcodes)); |
44 end | 44 end |
45 | 45 |
46 encode = function (s) | 46 encode = function (s) |
47 return s and (s:gsub("%W", function (c) return format("%%%x", c:byte()); end)); | 47 return s and (s:gsub("%W", function (c) return format("%%%02x", c:byte()); end)); |
48 end | 48 end |
49 end | 49 end |
50 | 50 |
51 ------- API ------------- | 51 ------- API ------------- |
52 | 52 |