Commit dc82f70e authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-13633 JSON_ARRAY() - bad output with some UTF8 characters.

        set_charset() calls added for Item_func_json_arran
        and Item_func_json_object::val_str-s.
parent a237a920
...@@ -699,3 +699,9 @@ select @str, @path, JSON_EXTRACT(@str, @path); ...@@ -699,3 +699,9 @@ select @str, @path, JSON_EXTRACT(@str, @path);
select json_array(5,json_query('[1,2]','$')); select json_array(5,json_query('[1,2]','$'));
json_array(5,json_query('[1,2]','$')) json_array(5,json_query('[1,2]','$'))
[5, [1,2]] [5, [1,2]]
SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
json_data
["1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú"]
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
json_data
{"user": "Jožko Mrkvičká"}
...@@ -354,3 +354,9 @@ select @str, @path, JSON_EXTRACT(@str, @path); ...@@ -354,3 +354,9 @@ select @str, @path, JSON_EXTRACT(@str, @path);
# #
select json_array(5,json_query('[1,2]','$')); select json_array(5,json_query('[1,2]','$'));
#
# MDEV-13633 JSON_ARRAY() - bad output with some UTF8 characters.
#
SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
...@@ -1473,6 +1473,7 @@ String *Item_func_json_array::val_str(String *str) ...@@ -1473,6 +1473,7 @@ String *Item_func_json_array::val_str(String *str)
uint n_arg; uint n_arg;
str->length(0); str->length(0);
str->set_charset(collation.collation);
if (str->append("[", 1) || if (str->append("[", 1) ||
((arg_count > 0) && append_json_value(str, args[0], &tmp_val))) ((arg_count > 0) && append_json_value(str, args[0], &tmp_val)))
...@@ -1797,6 +1798,7 @@ String *Item_func_json_object::val_str(String *str) ...@@ -1797,6 +1798,7 @@ String *Item_func_json_object::val_str(String *str)
uint n_arg; uint n_arg;
str->length(0); str->length(0);
str->set_charset(collation.collation);
if (str->append("{", 1) || if (str->append("{", 1) ||
(arg_count > 0 && (arg_count > 0 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment