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:
dsa-t
2025-12-20 03:19:19 +03:00
parent efdf8a0854
commit a2657db5e5
+12 -2
View File
@@ -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;
}