From f9a575e81ac02270bc28efa632695a0e5ec21e69 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 9 Jul 2018 15:24:16 +0300 Subject: [PATCH] Avoid problems with encodings: read file in binary mode. --- src/SalomeApp/SalomeApp_Application.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 895e7c7a2..5bb774c5e 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -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( 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(); -- 2.39.2