Slicer ignoring command line path with accents

Hi all, I’m getting this error when trying to load a file in command line:

Slicer /home/mark/Docs/GMM_Cráneos_Armadillos/Models/cvi_24.ply

Then, the error below shows strange characters where the “á” was in the path.

Ignore argument received via command-line (not a valid URL or existing local file): "/home/mark/Docs/GMM_Cráneos_Armadillos/Models/cvi_24.ply

My locale output is:

LANG=es_AR.UTF-8
LANGUAGE=es:en_US
LC_CTYPE=“es_AR.UTF-8”
LC_NUMERIC=es_AR.UTF-8
LC_TIME=es_AR.UTF-8
LC_COLLATE=“es_AR.UTF-8”
LC_MONETARY=es_AR.UTF-8
LC_MESSAGES=“es_AR.UTF-8”
LC_PAPER=es_AR.UTF-8
LC_NAME=es_AR.UTF-8
LC_ADDRESS=es_AR.UTF-8
LC_TELEPHONE=es_AR.UTF-8
LC_MEASUREMENT=es_AR.UTF-8
LC_IDENTIFICATION=es_AR.UTF-8
LC_ALL=

System KDE Neon 5.25 (Ubuntu Focal)

I was able to reproduce this:

perklab@perklabseg:~/Slicer/Slicer-5.0.2-linux-amd64$ ./Slicer --testing --python-code "print('GMM_Cráneos_Armadillo\n')"
Switch to module:  "Welcome"
GMM_Cráneos_Armadill
Switch to module:  ""
Switch to module:  ""

I’ve tried the same command with bypassing the launcher (started bash with the launcher and then started SlicerApp-real from there) and it worked well:

perklab@perklabseg:~/Slicer/Slicer-5.0.2-linux-amd64$ ./Slicer --launch bash
perklab@perklabseg:~/Slicer/Slicer-5.0.2-linux-amd64$ ./bin/SlicerApp-real --testing --python-code "print('GMM_Cráneos_Armadillo\n')"
Switch to module:  "Welcome"
GMM_Cráneos_Armadillo
Switch to module:  ""
Switch to module:  ""

I’ve had a look at the code and found the root cause of the problem. The launcher does not use UTF8 everywhere, but there are toLatin1 calls in it. We should replace those by toLocal8bit or toUtf8. I’ve submitted a pull request with this change: