diff --git a/pcbnew/import_gfx/svg_import_plugin.cpp b/pcbnew/import_gfx/svg_import_plugin.cpp
index 903aaea5d0..d6fb4efda4 100644
--- a/pcbnew/import_gfx/svg_import_plugin.cpp
+++ b/pcbnew/import_gfx/svg_import_plugin.cpp
@@ -54,8 +54,11 @@ bool SVG_IMPORT_PLUGIN::Load( const wxString& aFileName )
 {
     wxCHECK( m_importer, false );
 
-    // wxFopen takes care of unicode filenames across platforms
-    FILE* fp = wxFopen( aFileName, wxT( "rt" ) );
+    // 1- wxFopen takes care of unicode filenames across platforms
+    // 2 - nanosvg (exactly nsvgParseFromFile) expects a binary file (exactly the CRLF eof must
+    // not be replaced by LF and changes the byte count) in one validity test,
+    // so open it in binary mode.
+    FILE* fp = wxFopen( aFileName, wxT( "rb" ) );
 
     if( fp == nullptr )
         return false;
diff --git a/thirdparty/nanosvg/nanosvg.cpp b/thirdparty/nanosvg/nanosvg.cpp
index b6f3ca559b..2444b429b8 100644
--- a/thirdparty/nanosvg/nanosvg.cpp
+++ b/thirdparty/nanosvg/nanosvg.cpp
@@ -3688,6 +3688,8 @@ NSVGimage* nsvgParseFromFile( FILE *fp, const char* units, float dpi )
     if( data == NULL )
         goto error;
 
+    // This test works only if fp is open in binary mode, i.e. if the CRLF eol is not
+    // replaced by LF when reading the file
     if( fread( data, 1, size, fp ) != size )
         goto error;