diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 7efc31828a..e4fca9cf44 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -1231,11 +1231,7 @@ bool PDF_PLOTTER::EndPlot() fprintf( m_outputFile, " /A << /Type /Action /S /JavaScript /JS (%s) >>\n" ">>\n", -#ifdef __WXMAC__ js.ToStdString().c_str() ); -#else - TO_UTF8( js ) ); -#endif closePdfObject(); } diff --git a/common/string_utils.cpp b/common/string_utils.cpp index 7c2395bf85..54759bd9a5 100644 --- a/common/string_utils.cpp +++ b/common/string_utils.cpp @@ -196,7 +196,14 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext ) } else if( aContext == CTX_JS_STR ) { - if( c == '\'' ) + if( c >= 0x7F ) + { + 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}" );