File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ struct escape_impl<escaped_string_json<OutputIterator>>
128128 case ' \r ' : generated += " \\ r" ; break ;
129129 case ' \t ' : generated += " \\ t" ; break ;
130130 default :
131- if (c < 0x20 )
131+ if (c < 0x20 || c >= 0x7f )
132132 {
133133 generated += " \\ u00" ;
134134 generated += hex_digits[(c >> 4 ) & 0x0F ];
Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ BOOST_AUTO_TEST_CASE(test_string_escape_json)
9292 check_string_escaping_json (" \b " , " \\ b" );
9393 check_string_escaping_json (" \f " , " \\ f" );
9494 check_string_escaping_json (" \t " , " \\ t" );
95+ check_string_escaping_json (std::string (" \x7f " , 1 ), " \u007F " );
96+ check_string_escaping_json (std::string (" \xe9 " , 1 ), " \u00E9 " );
9597 check_string_escaping_json (" \v " , " \\ u000B" );
9698 check_string_escaping_json (" \r\n " , " \\ r\\ n" );
9799}
You can’t perform that action at this time.
0 commit comments