mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Convert smart quotes and dashes in reports to ASCII quotes and dashes.
Fixes https://gitlab.com/kicad/code/kicad/issues/1861
This commit is contained in:
parent
5684708b22
commit
0a6a91b5ad
@ -26,6 +26,7 @@
|
|||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <gal/color4d.h>
|
#include <gal/color4d.h>
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
|
WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
@ -343,7 +344,10 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
|
|||||||
|
|
||||||
for( const REPORT_LINE& l : m_report )
|
for( const REPORT_LINE& l : m_report )
|
||||||
{
|
{
|
||||||
f.Write( generatePlainText( l ) );
|
wxString s = generatePlainText( l );
|
||||||
|
|
||||||
|
ConvertSmartQuotesAndDashes( &s );
|
||||||
|
f.Write( s );
|
||||||
}
|
}
|
||||||
m_ReportFileName = fn.GetFullPath();
|
m_ReportFileName = fn.GetFullPath();
|
||||||
f.Close();
|
f.Close();
|
||||||
|
@ -40,6 +40,33 @@
|
|||||||
static const char illegalFileNameChars[] = "\\/:\"<>|";
|
static const char illegalFileNameChars[] = "\\/:\"<>|";
|
||||||
|
|
||||||
|
|
||||||
|
bool ConvertSmartQuotesAndDashes( wxString* aString )
|
||||||
|
{
|
||||||
|
bool retVal = false;
|
||||||
|
|
||||||
|
for( wxString::iterator ii = aString->begin(); ii != aString->end(); ++ii )
|
||||||
|
{
|
||||||
|
if( *ii == L'\u0060' || *ii == L'\u00B4' || *ii == L'\u2018' || *ii == L'\u2019' )
|
||||||
|
{
|
||||||
|
*ii = '\'';
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
if( *ii == L'\u201C' || *ii == L'\u201D' )
|
||||||
|
{
|
||||||
|
*ii = '"';
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
if( *ii == L'\u2013' || *ii == L'\u2014' )
|
||||||
|
{
|
||||||
|
*ii = '-';
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These Escape/Unescape routines use HTML-entity-reference-style encoding to handle
|
* These Escape/Unescape routines use HTML-entity-reference-style encoding to handle
|
||||||
* characters which are:
|
* characters which are:
|
||||||
|
@ -38,6 +38,13 @@
|
|||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts curly quotes and em/en dashes to straight quotes and dashes.
|
||||||
|
* @param aString
|
||||||
|
* @return true if any characters required conversion.
|
||||||
|
*/
|
||||||
|
bool ConvertSmartQuotesAndDashes( wxString* aString );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape/Unescape routines to safely encode reserved-characters in various
|
* Escape/Unescape routines to safely encode reserved-characters in various
|
||||||
* contexts.
|
* contexts.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user