Skip to content

Commit

Permalink
Json: escape extended ascii characters
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Jun 12, 2018
1 parent e211cd6 commit cbf9592
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/opamJson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ let adds_esc b s =
match String.get s i with
| '"' -> flush b start i; adds b "\\\""; loop next next
| '\\' -> flush b start i; adds b "\\\\"; loop next next
| '\x00' .. '\x1F' | '\x7F' (* US-ASCII control chars *) as c ->
| '\x00' .. '\x1F' | '\x7F' (* US-ASCII control chars *)
| '\x80' .. '\xFF' (* Extended ASCII chars *) as c ->
flush b start i;
adds b (Printf.sprintf "\\u%04X" (Char.code c));
loop next next
Expand Down

0 comments on commit cbf9592

Please sign in to comment.