I think this should be a good option. Thanks.
I just tried âswipl-w64-2022-05-04.exe Tue May 3 20:23:43 2022 12,968,860â in windows 7 (in VMware). It seems that it doesnât fix anything:
Given a UTF-8 file encoding.pl
If I set nothing in init.pl, then
In windows 7 command line with 65001:
c:\work-pl\prolog>swipl encoding.pl
ERROR: c:/work-pl/prolog/encoding.pl:3:21: Syntax error: illegal_character
ERROR: c:/work-pl/prolog/encoding.pl:5:1: Syntax error: End of file in quoted string
Warning: c:/work-pl/prolog/encoding.pl:19:
Warning: 'c:/work-pl/prolog/encoding.pl':19:8: Illegal multibyte Sequence
Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.10-53-g5637fed39)
In windows 7 Emacs with UTF-8 encoding:
?- consult(["encoding.pl"]).
ERROR: c:/work-pl/prolog/encoding.pl:3:21: Syntax error: illegal_character
ERROR: c:/work-pl/prolog/encoding.pl:5:1: Syntax error: End of file in quoted string
Warning: c:/work-pl/prolog/encoding.pl:19:
Warning: 'c:/work-pl/prolog/encoding.pl':19:8: Illegal multibyte Sequence
If I set
:- set_prolog_flag(encoding, utf8).
in init.pl, then
In windows 7 command line with 65001:
It is OK.
In windows 7 Emacs with UTF-8 encoding:
?- consult(["encoding.pl "]).
ERROR: c:/work-pl/prolog/encoding.pl :3:21: Syntax error: illegal_character
ERROR: c:/work-pl/prolog/encoding.pl :5:1: Syntax error: End of file in quoted string
Warning: c:/work-pl/prolog/encoding.pl :20:
Warning: 'c:/work-pl/prolog/encoding.pl ':20:0: Illegal multibyte Sequence
Therefore, in order to fix the Emacsâ problem, I still need to set init.pl
:- set_prolog_flag(encoding, utf8).
:- set_stream(user_input, encoding(utf8)).
:- set_stream(user_output, encoding(utf8)).
:- set_stream(user_error, encoding(utf8)).
But that will cause the âNo permissionâ problem when running in command line.
All in all, there is nothing to be changed.