diff --git a/core/Charstring.cc b/core/Charstring.cc index ee5e72d5df87f5fc0dd20688993ed0a5dc849a19..fc14f30e18267e24a461a398651b76b355010828 100644 --- a/core/Charstring.cc +++ b/core/Charstring.cc @@ -1664,7 +1664,8 @@ char* CHARSTRING::to_JSON_string(json_string_escaping mode) const } // fall through if ESCAPE_AS_TRANSPARENT default: - if (val_ptr->chars_ptr[i] <= 0x1F || val_ptr->chars_ptr[i] == 0x7F) { + if ((val_ptr->chars_ptr[i] >= 0 && val_ptr->chars_ptr[i] <= 0x1F) || + val_ptr->chars_ptr[i] == 0x7F) { // C0 control characters use USI-like escape sequences json_str = mputprintf(json_str, "\\u00%X%X", val_ptr->chars_ptr[i] / 16, val_ptr->chars_ptr[i] % 16); diff --git a/core/Optional.hh b/core/Optional.hh index 112cc1986f1abb4c90d9e0190d3d0248fbd14bbe..c9c64b4a03ce856792e183043a0bf69dacbdeecc 100644 --- a/core/Optional.hh +++ b/core/Optional.hh @@ -893,7 +893,7 @@ int OPTIONAL<T_type>::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokeni p_tok.set_buf_pos(buf_pos); } } - dec_len = optional_value->JSON_decode(p_td, p_tok, p_silent, p_chosen_field); + dec_len = optional_value->JSON_decode(p_td, p_tok, p_silent, FALSE, p_chosen_field); if (JSON_ERROR_FATAL == dec_len) { if (p_silent) { clean_up(); diff --git a/regression_test/EncodeDecode/JSON/JsonComplexTest/JsonTestcases.ttcn b/regression_test/EncodeDecode/JSON/JsonComplexTest/JsonTestcases.ttcn index 97c30ba27e5e8eabc001fdbae6047dccf7372438..4dcc60bcfaa098e96179d12b6bdf3c2f716a16f4 100644 --- a/regression_test/EncodeDecode/JSON/JsonComplexTest/JsonTestcases.ttcn +++ b/regression_test/EncodeDecode/JSON/JsonComplexTest/JsonTestcases.ttcn @@ -153,7 +153,7 @@ testcase tc_charstring_ascii_basic_escapes() runs on MTC{ "\r","\t","\f","\b" }; var RoOS os_expected := { - '225C5C22'O, '222F22'O,'225C6E22'O, + '225C5C22'O, '225C2F22'O,'225C6E22'O, '225C7222'O,'225C7422'O,'225C6622'O, '225C6222'O }; var integer len:=lengthof(cs); @@ -259,7 +259,7 @@ testcase tc_ucharstring_higherplanes() runs on MTC{ char(0,3,0,0) & char(0,3,0,175) & char(0,3,255,255), char(0,15,0,0)& char(0,15,0,175)& char(0,15,255,255), char(0,16,0,0)& char(0,16,0,175)& char(0,16,255,255), - char(0,16,0,0) & char(0,0,0,1) & " " + char(0,16,0,0) & " " }; var octetstring os; var integer len:=lengthof(us);