mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Fixed base64 issue with UTF-8 strings
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
This commit is contained in:
committed by
Nicolas Williams
parent
ba1acbe961
commit
9f4d7e2fb8
@@ -454,7 +454,7 @@ static jv f_format(jv input, jv fmt) {
|
|||||||
input = f_tostring(input);
|
input = f_tostring(input);
|
||||||
jv line = jv_string("");
|
jv line = jv_string("");
|
||||||
const char b64[64 + 1] = CHARS_ALPHANUM "+/";
|
const char b64[64 + 1] = CHARS_ALPHANUM "+/";
|
||||||
const char* data = jv_string_value(input);
|
const unsigned char* data = (const unsigned char*)jv_string_value(input);
|
||||||
int len = jv_string_length_bytes(jv_copy(input));
|
int len = jv_string_length_bytes(jv_copy(input));
|
||||||
for (int i=0; i<len; i+=3) {
|
for (int i=0; i<len; i+=3) {
|
||||||
uint32_t code = 0;
|
uint32_t code = 0;
|
||||||
|
@@ -71,6 +71,11 @@ null
|
|||||||
"'<>&'\\''\"'"
|
"'<>&'\\''\"'"
|
||||||
"PD4mJyI="
|
"PD4mJyI="
|
||||||
|
|
||||||
|
# regression test for #436
|
||||||
|
@base64
|
||||||
|
"foóbar\n"
|
||||||
|
"Zm/Ds2Jhcgo="
|
||||||
|
|
||||||
@uri
|
@uri
|
||||||
"\u03bc"
|
"\u03bc"
|
||||||
"%CE%BC"
|
"%CE%BC"
|
||||||
|
Reference in New Issue
Block a user