aboutsummaryrefslogtreecommitdiff
path: root/src/tafwriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tafwriter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tafwriter.cpp b/src/tafwriter.cpp
index c30bc67..8e5fcdc 100644
--- a/src/tafwriter.cpp
+++ b/src/tafwriter.cpp
@@ -93,12 +93,18 @@ void Bu::TafWriter::writeString( const Bu::FString &str )
93 if( str.getStr() == NULL ) 93 if( str.getStr() == NULL )
94 return; 94 return;
95 sOut.write("\"", 1 ); 95 sOut.write("\"", 1 );
96 for( const char *s = str.getStr(); *s; s++ ) 96 for( Bu::FString::const_iterator s = str.begin(); s != str.end(); s++ )
97 { 97 {
98 if( *s == '\"' ) 98 if( *s == '\"' )
99 sOut.write("\\\"", 2 ); 99 sOut.write("\\\"", 2 );
100 else if( *s == '\\' ) 100 else if( *s == '\\' )
101 sOut.write("\\\\", 2 ); 101 sOut.write("\\\\", 2 );
102 else if( *s < 32 || *s > 126 )
103 {
104 char buf[5];
105 sprintf( buf, "\\x%02X", (unsigned char)*s );
106 sOut.write(buf, 4 );
107 }
102 else 108 else
103 sOut.write( s, 1 ); 109 sOut.write( s, 1 );
104 } 110 }