From: rnv Date: Mon, 9 Jul 2018 12:24:16 +0000 (+0300) Subject: Avoid problems with encodings: read file in binary mode. X-Git-Tag: SHAPER_V9_1_0RC1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f9a575e81ac02270bc28efa632695a0e5ec21e69;p=modules%2Fgui.git Avoid problems with encodings: read file in binary mode. --- 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();