From: rnv Date: Fri, 19 Jan 2018 12:59:54 +0000 (+0300) Subject: Implement unicode support in SALOME: first attempt X-Git-Tag: SHAPER_V9_1_0RC1~7^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4bcb2f56e92b7eab9f660cb78e8a52121194b0ff;p=modules%2Fgui.git Implement unicode support in SALOME: first attempt --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 462f1a389..eb93a7be7 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\",encoding='utf-8').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\",encoding='utf-8').read())").arg(aFile); #ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = pythonConsole(); @@ -924,7 +924,7 @@ void SalomeApp_Application::onLoadScript( ) if ( !aFile.isEmpty() ) { - QString command = QString("exec(open(\"%1\").read())").arg(aFile); + QString command = QString("exec(open(\"%1\",encoding='utf-8').read())").arg(aFile); #ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = pythonConsole(); @@ -1958,7 +1958,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\",encoding='utf-8').read())" ).arg( theDumpScript ); #ifndef DISABLE_PYCONSOLE PyConsole_Console* pyConsole = app->pythonConsole(); diff --git a/tools/PyConsole/src/PyConsole_Request.cxx b/tools/PyConsole/src/PyConsole_Request.cxx index aa41c259e..690d3dbbd 100644 --- a/tools/PyConsole/src/PyConsole_Request.cxx +++ b/tools/PyConsole/src/PyConsole_Request.cxx @@ -56,7 +56,7 @@ PyConsole_ExecCommand::PyConsole_ExecCommand( PyInterp_Interp* theInterp, void PyConsole_ExecCommand::execute() { if ( myCommand != "" ) { - int ret = getInterp()->run( myCommand.toLatin1().data() ); + int ret = getInterp()->run( myCommand.toUtf8().data() ); if ( ret < 0 ) myState = PyInterp_Event::ES_ERROR; else if ( ret > 0 )