File tree 1 file changed +28
-0
lines changed 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -2702,6 +2702,34 @@ JSONTEST_FIXTURE_LOCAL(StreamWriterTest, escapeControlCharacters) {
2702
2702
}
2703
2703
}
2704
2704
2705
+ #ifdef _WIN32
2706
+ JSONTEST_FIXTURE_LOCAL (StreamWriterTest, escapeTabCharacterWindows) {
2707
+ // Get the current locale before changing it
2708
+ std::string currentLocale = setlocale (LC_ALL, NULL );
2709
+ setlocale (LC_ALL, " English_United States.1252" );
2710
+
2711
+ Json::Value root;
2712
+ root[" test" ] = " \t TabTesting\t " ;
2713
+
2714
+ Json::StreamWriterBuilder b;
2715
+
2716
+ JSONTEST_ASSERT (Json::writeString (b, root) == " {\n\t\" test\" : "
2717
+ " \"\\ tTabTesting\\ t\"\n }" );
2718
+
2719
+ b.settings_ [" emitUTF8" ] = true ;
2720
+ JSONTEST_ASSERT (Json::writeString (b, root) == " {\n\t\" test\" : "
2721
+ " \"\\ tTabTesting\\ t\"\n }" );
2722
+
2723
+ b.settings_ [" emitUTF8" ] = false ;
2724
+ JSONTEST_ASSERT (Json::writeString (b, root) == " {\n\t\" test\" : "
2725
+ " \"\\ tTabTesting\\ t\"\n }" );
2726
+
2727
+ // Restore the locale
2728
+ if (!currentLocale.empty ())
2729
+ setlocale (LC_ALL, currentLocale.c_str ());
2730
+ }
2731
+ #endif
2732
+
2705
2733
struct ReaderTest : JsonTest::TestCase {
2706
2734
void setStrictMode () {
2707
2735
reader = std::unique_ptr<Json::Reader>(
You can’t perform that action at this time.
0 commit comments