Hello,
is it possible to use German Umlauts for Fact’s ?
I used the following Code, and get Error Message:
mathe_text_1(Text) :-
Text = 'ist eine mathematische Ziffer'.
fünf :- mathe_text_1(MatheText), format('fünf ~w', [MatheText]), nl.
Hello,
is it possible to use German Umlauts for Fact’s ?
I used the following Code, and get Error Message:
mathe_text_1(Text) :-
Text = 'ist eine mathematische Ziffer'.
fünf :- mathe_text_1(MatheText), format('fünf ~w', [MatheText]), nl.
Sure. You must make sure that Prolog understands the encoding of the file though. How depends on the platform. On many platforms using UTF-8 encoding is the default and this is properly communicated to applications. On some, this may be more problematic (notably Windows). So, what is the platform and what is the encoding in the file?
it is the Windows 11 64-Bit Pro Command Line Console.
I used the Command “chcp 65001” and get UTF-8.
but the Code:
fünf :- mathe_text_1(Text), format(‘fünf ~w’, [Text]).
give me Error Message:
ERROR: t:/a/swipl-prolog/src/test1.pl:31:3: Syntax error: Operator expected
SOLUTION:
I use notepad++ witn ASCII Codec - than i have no problems anymore with German Umlauts.
The German umlaut is not in ASCII, so hopefully notepad++ combined this with the UTF-8 code page to use UTF-8. AFAIK, SWI-Prolog picks up the activation of the 65001 code page and switches to UTF-8. So, all is good.
If you want to verify this all works, use
?- current_prolog_flag(encoding, E).
Which should tell you E = utf8
.
Year after year, the use of Unicode becomes less problematic