Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding issues with Prolog API #5

Closed
guregu opened this issue Apr 18, 2022 · 1 comment
Closed

encoding issues with Prolog API #5

guregu opened this issue Apr 18, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@guregu
Copy link
Owner

guregu commented Apr 18, 2022

Atom quoting

SWI doesn't quote non-ASCII by default, but ichiban/prolog requires it. So Japanese, for example '漢字' will break it.

There's a workaround:

pengines:write_result(prolog, Event, _) :-
    format('Content-type: text/x-prolog; charset=UTF-8~n~n'),
    write_term(Event,
               [ quoted(true),
                 quote_non_ascii(true),           % 🆕
                 character_escapes_unicode(true), % 🆕
                 ignore_ops(true),
                 fullstop(true),
                 blobs(portray),
                 portray_goal(portray_blob),
                 nl(true)
               ]).

Operator quoting

Our Write params in predicate.go aren't good enough. We need to pass at LEAST the comma operator to engine.Write to avoid sending invalid code like , (foo, bar) which SWI doesn't like. Either fix it to be ','(foo, bar) or (foo, bar).

@guregu guregu added the bug Something isn't working label Apr 18, 2022
@guregu
Copy link
Owner Author

guregu commented Apr 18, 2022

Fixed the operator issue in v0.1.2 and added a note about atom quoting in the README.

@guregu guregu closed this as completed Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant