From 71724bea0c802196db01e616563ada9eeeb741b4 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 4 Sep 2022 10:28:51 +0100 Subject: [PATCH] Remove curly brace from string encoding. It causes issues with formatting constructs and text variable refs, and it's not a reserved character even in filenames. Fixes https://gitlab.com/kicad/code/kicad/issues/12351 --- common/string_utils.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/common/string_utils.cpp b/common/string_utils.cpp index a9f6c2043d..29ee625cc1 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -145,13 +145,6 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) wxString converted; std::vector braceStack; // true == formatting construct - auto hasFormattingPrefix = - [&]() - { - static wxString prefixes = wxT( "~_^" ); - return !converted.IsEmpty() && prefixes.Find( converted.Last() ) >= 0; - }; - converted.reserve( aSource.length() ); for( wxUniChar c: aSource ) @@ -167,9 +160,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) } else if( aContext == CTX_LIBID ) { - if( c == '{' && !hasFormattingPrefix() ) - converted += wxT( "{brace}" ); - else if( c == '/' ) + if( c == '/' ) converted += wxT( "{slash}" ); else if( c == '\\' ) converted += wxT( "{backslash}" ); @@ -213,9 +204,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) } else if( aContext == CTX_FILENAME ) { - if( c == '{' ) - converted += wxT( "{brace}" ); - else if( c == '/' ) + if( c == '/' ) converted += wxT( "{slash}" ); else if( c == '\\' ) converted += wxT( "{backslash}" ); @@ -240,8 +229,6 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) { if( c == ' ' ) converted += wxT( "{space}" ); - else if( c == '{' ) - converted += wxT( "{brace}" ); else converted += c; }