SWI-Prolog / packages-mqi

Machine Query Interface
13 stars 5 forks source link

Problem with unicode characters (e.g. →) in prolog file #14

Closed Losbarthos closed 2 years ago

Losbarthos commented 2 years ago

I have some simple prolog file logic.pl introducing some operator with unicode characters:

:-op(803, xfy, →).

binary_connective(X  → Y, X, Y).

The problem now is, that my python query does not work on that operator:

from swiplserver import PrologMQI, PrologThread

with PrologMQI() as mqi:
    with mqi.create_thread() as prolog_thread:
        prolog_thread.query(f"consult('logic.pl').")
        prolog_thread.query_async("binary_connective(p  → q, X, Y).",
                                  find_all=False)
        while True:
            result = prolog_thread.query_async_result()
            if result is None:
                break
            else:
                print(result)

If I change → in -- it gives me some working result.

Is their some way to solve this in swiplserver libary?

JanWielemaker commented 2 years ago

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/problem-with-unicode-characters-e-g-in-prolog-file/4945/1

JanWielemaker commented 2 years ago

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-7/4979/1

JanWielemaker commented 2 years ago

This issue has been mentioned on SWI-Prolog. There might be relevant details there:

https://swi-prolog.discourse.group/t/ann-swi-prolog-8-4-2-stable/5004/1