Open xh4 opened 5 years ago
The encoding
flag initialization is derived from LD->encoding
which is initialized at is at https://github.com/SWI-Prolog/swipl-devel/blob/14668201036cb8d6fd9d5095bb58d6be6e8b6993/src/os/pl-ctype.c#L886
Here we see it only used LC_CTYPE
locale. This is a bit shaky. On the one hand we do not rely on the environment variables directly, but let setlocale() figure it out depending on the platform. On the other hand setlocale() returns according to the docs an opaque string. On most (Unix) systems this is simply the final locale name.
I do not know much about Microsoft locale handling. Here is a link that doesn't sound promising.
Note that utf8
merely replaces the rather indirect route through the C library for I/O conversion with its own dedicated UTF-8 routines. If the system does UTF-8 as specified by the locale this should still work as text
simply state leave it to the C library.
The docs about LANG
are wrong though and I do not really know how to make Windows UTF-8 friendly. If you know, share it and I'll try to make SWI-Prolog cooperate.
For Prolog itself you can set encoding
in your swipl.ini or application.
SWI-Prolog version 8.0.2 on Windows 10
On Windows, the
encoding
of prolog always set totext
regardless of theLANG
environment variable.