aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tests/json.cpp2
-rw-r--r--src/unstable/json.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/tests/json.cpp b/src/tests/json.cpp
index d588a02..6490d8d 100644
--- a/src/tests/json.cpp
+++ b/src/tests/json.cpp
@@ -5,7 +5,7 @@
5 5
6int main( int argc, char *argv[] ) 6int main( int argc, char *argv[] )
7{ 7{
8 Bu::Json j("Hi there"); 8 Bu::Json j( "\x01" "ACTION" "\x01" );
9 Bu::println( j.toString() ); 9 Bu::println( j.toString() );
10 return 0; 10 return 0;
11} 11}
diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp
index adc2706..06df9b1 100644
--- a/src/unstable/json.cpp
+++ b/src/unstable/json.cpp
@@ -747,7 +747,16 @@ void Bu::Json::writeStr( const Bu::String &sStr, Bu::Stream &sOutput ) const
747 break; 747 break;
748 748
749 default: 749 default:
750 sOutput.write( &(*i), 1 ); 750 if( *i < 32 )
751 sOutput.write(
752 Bu::String("\\u%1").
753 arg( (int32_t)*i, Bu::Fmt::hex(4).fill('0') ).
754 end().getStr(),
755 6
756 );
757 else
758 sOutput.write( &(*i), 1 );
759 break;
751 } 760 }
752 } 761 }
753 sOutput.write("\"", 1 ); 762 sOutput.write("\"", 1 );