From 21f474332071fa07ce5b89b2e460f3e0962ddbcc Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 15 Dec 2020 22:16:33 -0500 Subject: [PATCH] fix(urlencode): encode non ascii chars --- src/Tiny_httpd_util.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tiny_httpd_util.ml b/src/Tiny_httpd_util.ml index 259dae2d..2e614c91 100644 --- a/src/Tiny_httpd_util.ml +++ b/src/Tiny_httpd_util.ml @@ -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