Don't use KiCad escape sequences for JS text.

Fixes https://gitlab.com/kicad/code/kicad/issues/12782
This commit is contained in:
Jeff Young 2022-11-06 15:13:26 +00:00
parent 90c5295a9f
commit 76ce580bd0
1 changed files with 3 additions and 5 deletions

View File

@ -196,20 +196,18 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
} }
else if( aContext == CTX_JS_STR ) else if( aContext == CTX_JS_STR )
{ {
if( c >= 0x7F ) if( c >= 0x7F || c == '\'' || c == '\\' )
{ {
unsigned int code = c; unsigned int code = c;
char buffer[16]; char buffer[16];
sprintf( buffer, "\\\\u%4.4X", code ); sprintf( buffer, "\\\\u%4.4X", code );
converted += buffer; converted += buffer;
} }
else if( c == '\'' )
converted += wxT( "{quote}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
else else
{
converted += c; converted += c;
} }
}
else if( aContext == CTX_LINE ) else if( aContext == CTX_LINE )
{ {
if( c == '\n' || c == '\r' ) if( c == '\n' || c == '\r' )