Salome HOME
Implement unicode support in SALOME: first attempt
authorrnv <rnv@opencascade.com>
Fri, 19 Jan 2018 12:59:54 +0000 (15:59 +0300)
committerrnv <rnv@opencascade.com>
Fri, 19 Jan 2018 12:59:54 +0000 (15:59 +0300)
src/SalomeApp/SalomeApp_Application.cxx
tools/PyConsole/src/PyConsole_Request.cxx

index 462f1a389ee483d65b36fb32bac035c597eff90e..eb93a7be75d38d6d969e4296d5d2fbd3f74f6936 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\",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<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\",encoding='utf-8').read())" ).arg( theDumpScript );
 
 #ifndef DISABLE_PYCONSOLE
   PyConsole_Console* pyConsole = app->pythonConsole();
index aa41c259ec1753d09ab02aea575a24e88b28877c..690d3dbbd5437e1d7b463d021c6d1d1d52334c29 100644 (file)
@@ -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 )