From 1318d46efaedca620737d61f66329b888cd73132 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 6 Dec 2024 14:42:17 -0500 Subject: [PATCH] fix percent encoding on control chars --- src/core/util.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/util.ml b/src/core/util.ml index 38d9bbb9..c7048f01 100644 --- a/src/core/util.ml +++ b/src/core/util.ml @@ -6,7 +6,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 when Char.code c < 32 || Char.code c > 127 -> + Printf.bprintf buf "%%%X" (Char.code c) | c -> Buffer.add_char buf c) s; Buffer.contents buf