Salome HOME
Python 3: PoC to correctly manage unicode strings from Python
authorGilles DAVID <gilles-g.david@edf.fr>
Wed, 31 May 2017 16:31:32 +0000 (18:31 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Wed, 31 May 2017 16:31:34 +0000 (18:31 +0200)
commit88111dfab48ab5324a529bcf2a88ff93e4547afa
tree1723311ed6ce07d934c8a5dd430df48cc92a5681
parentaafab53a937f2ccc30084b14349ae2ef565ca24b
Python 3: PoC to correctly manage unicode strings from Python

The following use case does not work because of the caracter 'é':
>>> import salome
>>> salome.salome_study_init('/tmp/étude.hdf')

The solution here is to consider Unicode strings coming from all the
interfaces of SALOME modules, and then to convert them to encoded strings.

To do that:
- all IDL "string" parameters should be changed into "wstring".
- all C++ interfaces should have wchar_t* instead of char*
- wchar_t* inputs should then be encoded to char* using an ENCODE function (to be written)
- wchar_t* outputs should be decoded from char* using a DECODE function (to be written)
bin/salome_utils.py
idl/SALOMEDS.idl
src/HDFPersist/HDFfile.cc
src/KERNEL_PY/salome_study.py
src/SALOMEDS/SALOMEDS_StudyManager.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_StudyManager_i.hxx