File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -2678,20 +2678,26 @@ JSONTEST_FIXTURE_LOCAL(StreamWriterTest, escapeControlCharacters) {
2678
2678
b.settings_ [" emitUTF8" ] = emitUTF8;
2679
2679
2680
2680
for (unsigned i = 0 ; i != 0x100 ; ++i) {
2681
+ if (!emitUTF8 && i >= 0x80 )
2682
+ break ; // The algorithm would try to parse UTF-8, so stop here.
2683
+
2681
2684
std::string raw ({static_cast <char >(i)});
2682
2685
std::string esc = raw;
2683
2686
if (i < 0x20 )
2684
2687
esc = uEscape (i);
2685
2688
if (const char * shEsc = shortEscape (i))
2686
2689
esc = shEsc;
2687
- if (!emitUTF8 && i >= 0x80 )
2688
- esc = uEscape (i);
2690
+
2691
+ // std::cout << "emit=" << emitUTF8 << ", i=" << std::hex << i << std::dec
2692
+ // << std::endl;
2689
2693
2690
2694
Json::Value root;
2691
2695
root[" test" ] = raw;
2692
2696
JSONTEST_ASSERT_STRING_EQUAL (
2693
2697
std::string (" {\n\t\" test\" : \" " ).append (esc).append (" \"\n }" ),
2694
- Json::writeString (b, root));
2698
+ Json::writeString (b, root))
2699
+ << " , emit=" << emitUTF8 << " , i=" << i << " , raw=\" " << raw << " \" "
2700
+ << " , esc=\" " << esc << " \" " ;
2695
2701
}
2696
2702
}
2697
2703
}
You can’t perform that action at this time.
0 commit comments