Fix assert failures when opening non-ASCII files in gerbview.
Fixes KICAD-KEV
(cherry picked from commit 7d03b6bb8c)
Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
This commit is contained in:
+12
-2
@@ -322,8 +322,18 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName )
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf( wxT( "Unexpected char 0x%2.2X (%c)" ), *text, *text );
|
||||
AddMessageToList( msg );
|
||||
char charBuf[2] = { *text, 0 };
|
||||
wchar_t wcharBuf[2] = { 0 };
|
||||
|
||||
wxWhateverWorksConv().ToWChar( wcharBuf, 1, charBuf, 1 );
|
||||
|
||||
if( wcharBuf[0] < 32 ) // Don't render control characters
|
||||
wcharBuf[0] = '?';
|
||||
|
||||
msg.Printf( wxT( "Unexpected char 0x%2.2X (%c)" ), (unsigned char) *text,
|
||||
wcharBuf[0] );
|
||||
|
||||
AddMessageToList( EscapeHTML( msg ) );
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user