1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Fix a bug in URI-encoding of certain non-ASCII characters.

Oh how I hate C casting rules.
This commit is contained in:
Stephen Dolan
2012-12-29 01:37:22 +00:00
parent 79c9c418c6
commit 3a5377e183
2 changed files with 5 additions and 1 deletions

View File

@ -306,7 +306,7 @@ static jv f_format(jv input, jv fmt) {
jv line = jv_string("");
const char* s = jv_string_value(input);
for (int i=0; i<jv_string_length(jv_copy(input)); i++) {
unsigned ch = (unsigned)*s;
unsigned ch = (unsigned)(unsigned char)*s;
if (ch < 128 && unreserved[ch]) {
line = jv_string_append_buf(line, s, 1);
} else {

View File

@ -62,6 +62,10 @@ null
"'<>&'\\''\"'"
"PD4mJyI="
@uri
"\u03bc"
"%ce%bc"
@html "<b>\(.)</b>"
"<script>hax</script>"
"<b>&lt;script&gt;hax&lt;/script&gt;</b>"