In a project I launch SWI-Prolog from another program using command line parameters
-x <file-in-install-folder> and -f <file-in-temp-folder>.
Currently I have no influence on the installation and temporary paths on the user’s side, so they can contain any Unicode character that are valid in paths. Unfortunately, SWI-Prolog does not find some paths with Unicode characters.
I checked the source code of SWI-Prolog. Currently, the entry point is
main(int argc, char **argv), which means on Windows that the command line arguments are received encoded in the code page defined by the system settings. For example per default in German/English Windows installations it is Latin-1 and in Japanese Windows installations it is Shift-JIS. I don’t know if I have understood the source code correctly, but it seems that in general the command line arguments (on Windows) are interpreted as Latin-1. If that is true, it means that paths with non-ASCII characters are only processed correctly, when the system setting is set to Latin-1 and the paths only contain Unicode characters that are contained in Latin-1 code page.
One easy solution would be to use the non-standard Windows specific
wmain(int argc, wchar_t **argv) in Windows build. But then it is not clear how to process them. PL_initialise also wants
char ** as argument type. So perhaps it needs a previous conversion to UTF-8, or a
PL_initialise(int argc, wchar_t **argv) would be needed.
So are there any plans to support Unicode command line arguments in Windows?
I’m not a Linux/Unix expert, so I don’t know if that problem also applies there.