]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Avoid problems with encodings: read file in binary mode.
authorrnv <rnv@opencascade.com>
Mon, 9 Jul 2018 12:24:16 +0000 (15:24 +0300)
committerrnv <rnv@opencascade.com>
Mon, 9 Jul 2018 12:24:16 +0000 (15:24 +0300)
src/SalomeApp/SalomeApp_Application.cxx

index 895e7c7a23e784a43933f2c42ad70145664b16ef..5bb774c5ed42d102eabab7bbd2685121109ca9a0 100644 (file)
@@ -272,7 +272,7 @@ void SalomeApp_Application::start()
 
               script.remove( QRegExp("^python.*[\\s]+") );
               QString cmd = script+" "+args;
-              QString command = QString( "exec(open(\"%1\").read())" ).arg(cmd.trimmed());
+              QString command = QString( "exec(open(\"%1\", \"rb\").read())" ).arg(cmd.trimmed());
               pyConsole->exec(command);
             }
           } // end for loop on pyfiles QStringList
@@ -497,7 +497,7 @@ void SalomeApp_Application::onNewWithScript()
   {
     onNewDoc();
 
-    QString command = QString("exec(open(\"%1\").read())").arg(aFile);
+    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
 
 #ifndef DISABLE_PYCONSOLE
     PyConsole_Console* pyConsole = pythonConsole();
@@ -934,7 +934,7 @@ void SalomeApp_Application::onLoadScript( )
 
   if ( !aFile.isEmpty() )
   {
-    QString command = QString("exec(open(\"%1\").read())").arg(aFile);
+    QString command = QString("exec(open(\"%1\", \"rb\").read())").arg(aFile);
 
 #ifndef DISABLE_PYCONSOLE
     PyConsole_Console* pyConsole = pythonConsole();
@@ -1968,7 +1968,7 @@ bool SalomeApp_Application::onRestoreStudy( const QString& theDumpScript,
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
 
   // load study from the temporary directory
-  QString command = QString( "exec(open(\"%1\").read())" ).arg( theDumpScript );
+  QString command = QString( "exec(open(\"%1\" ,\"rb\").read())" ).arg( theDumpScript );
 
 #ifndef DISABLE_PYCONSOLE
   PyConsole_Console* pyConsole = app->pythonConsole();