Hi
I am searching for exemples for using CIAO Prolog with unicode contents.
Are they possible in atoms and variables or only in variables?
How to elaborate unicode contents for HTML?
Is there somewhere a bibliothek online for Proloog applications using both?
Kind regards
On Fri, Jul 18, 2014 at 3:27 PM, <oui(a)mailoo.org> wrote:
Hi
I am searching for exemples for using CIAO Prolog with unicode contents.
Are they possible in atoms and variables or only in variables?
How to elaborate unicode contents for HTML?
Is there somewhere a bibliothek online for Proloog applications using both?
Hi,
You can use Unicode characters (UTF-8) in the code as long as it is part of a string or a quoted atom. For example, the following code is valid:
p(Z) :- X = '☆'('☀ ☆ ☂'), Y = '☆'(Z), X=Y.
q(Z) :- X = '☆'("☀ ☆ ☂"), Y = '☆'(Z), X=Y.
It is even possible to define operators:
:- op(100,xfy,'☆').
r(Z,M) :- X = '☀' '☆' '☂', Y = '☆'(Z,M), X=Y.
There are some limitations. First, unquoted characters cannot be used neither as part of atoms nor variables names. Secnod, there is no support for Unicode manipulation (unicode strings are represented as code of 1-byte characters). You may translate the sequence of bytes in UTF-8 to UTF-32. Ciao does not provide any functionality to do that, but we may add it if there is interest.
However, if you only need to read and write back Unicode strings without any manipulation, there should not be many problems.
Bests,