From 76ce580bd0ff067af44c045c4e262527ff47119a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 6 Nov 2022 15:13:26 +0000 Subject: [PATCH] Don't use KiCad escape sequences for JS text. Fixes https://gitlab.com/kicad/code/kicad/issues/12782 --- common/string_utils.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/string_utils.cpp b/common/string_utils.cpp index 54759bd9a5..888ba3f107 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -196,19 +196,17 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) } else if( aContext == CTX_JS_STR ) { - if( c >= 0x7F ) + if( c >= 0x7F || c == '\'' || c == '\\' ) { unsigned int code = c; char buffer[16]; sprintf( buffer, "\\\\u%4.4X", code ); converted += buffer; } - else if( c == '\'' ) - converted += wxT( "{quote}" ); - else if( c == '\\' ) - converted += wxT( "{backslash}" ); else + { converted += c; + } } else if( aContext == CTX_LINE ) {