mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
fix(urlencode): encode non ascii chars
This commit is contained in:
parent
70f1205880
commit
21f4743320
1 changed files with 2 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ let percent_encode ?(skip=fun _->false) s =
|
||||||
| ',' | '/' | ':' | ';' | '=' | '?' | '@' | '[' | ']' | '~')
|
| ',' | '/' | ':' | ';' | '=' | '?' | '@' | '[' | ']' | '~')
|
||||||
as c ->
|
as c ->
|
||||||
Printf.bprintf buf "%%%X" (Char.code c)
|
Printf.bprintf buf "%%%X" (Char.code c)
|
||||||
|
| c when Char.code c > 127 ->
|
||||||
|
Printf.bprintf buf "%%%X" (Char.code c)
|
||||||
| c -> Buffer.add_char buf c)
|
| c -> Buffer.add_char buf c)
|
||||||
s;
|
s;
|
||||||
Buffer.contents buf
|
Buffer.contents buf
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue