A bit more safety around control characters in strings.

This commit is contained in:
Jeff Young 2019-09-07 01:08:22 +01:00
parent 83a02e18eb
commit 1ac6cbc4a6
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,8 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
{ {
if( c == '/' ) if( c == '/' )
converted += "{slash}"; converted += "{slash}";
else if( c == '\n' || c == '\r' )
converted += ""; // drop
else else
converted += c; converted += c;
} }
@ -66,6 +68,8 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
converted += "{brace}"; converted += "{brace}";
else if( c == ':' ) else if( c == ':' )
converted += "{colon}"; converted += "{colon}";
else if( c == '\n' || c == '\r' )
converted += ""; // drop
else else
converted += c; converted += c;
} }