fix(urlencode): encode non ascii chars

This commit is contained in:
Simon Cruanes 2020-12-15 22:16:33 -05:00
parent 70f1205880
commit 21f4743320

View file

@ -18,6 +18,8 @@ let percent_encode ?(skip=fun _->false) s =
| ',' | '/' | ':' | ';' | '=' | '?' | '@' | '[' | ']' | '~')
as 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)
s;
Buffer.contents buf