Can I implement greek characters in Variable names?

I’m using: SWI-Prolog version :threaded, 64 bits, version 9.0.4 on emacs

I want the code to: define variable names with greek chars (utf16).

But what I’m getting is: Compile Syntax error

My code looks like this:

%see .png below
% your code here

when I first used :-encoding(utf8). I got a compile error, complaining about the use of greek letters in the predicate. using :-encoding(utf16be). I got rid of the error, but now there seems to be something wrong with the file format (unexpected EOF). Line 3 is the :-encoding(utf16be). obviously this line is not 945 chars long.

Any solutions?

Ok. I found out that using greek letters is not the issue. I can use the greek letter THETA for a variable and assign a value, and I can do calculations with it. So the problem is in the file format.
Skærmbillede 2024-11-08 122129

I should probably also add that I am working on a Windows PC.

Oh my word! it works :slight_smile:
I changed to encoding(utf8) instead of encoding(utf16be).
It didn’t work the first time though, and apparently the following in line 1 is also necessary: /* -*- coding UTF-16 -*- */
it looks a bit wonky but the outer /* … */ were necessary to protect from compile errors from SWI-Prolog.
So now I have:
Skærmbillede 2024-11-08 142356 :sunglasses:

Right. Yes, this is all outdated. I don’t think there is anything wrong with UTF-16 encoding, but it reads the encoding directive in the initial encoding. The initial encoding is determined by the BOM marker or, if this is not present, by the current locale.

UTF-8 is the way to go :slight_smile:

just an afterthought, variables still have to be Capitalized. So small cap rho for density is a no-no, but Capital Rho is ok. So I’ll say it works almost as intented.