I don’t know enough about the regression testing failure.
ü isn’t an extremly challenging Unicode code point, it
lives in a quite low Unicode block, it could be an error of
the harness in that the harness is 7-bit and not 8-bit stream.
Or it is an 8-bit stream from some locale and not UFT-8
or Latin-1_Supplement (ISO-8859-1):
?- char_code(ü, X).
X = 252.
But I guess I made an error in the html//1 example. Since
there is only encode/1 and not encode/2 that would also
take an URI part, I would need to write the code as:
?- X='1=2ü', html(a(href=encode('foo?bar='+X),''), L, []), writeq(L), nl.
ERROR: Type error: `atomic' expected, found `'foo?bar='+'1=2ü'' (a compoun
But encode doesn’t take an (+)/2 expression. Is this
a bug or feature? How do you encode a full URI, that is
itself an expression inside a html//1 call?
If I don’t lift it to the full URI, there might be the danger
that my value payload has ‘?’ and it doesn’t get encoded?
Since encode expects an URI and not a query value?
Edit 29.01.2023
Woa! I am doing all wrong. According to an example on the
SWI-Prolog website I should do something along:
predref(Name/Arity) -->
{ www_form_encode(Name, Encoded),
sformat(Href, '/cgi-bin/plman?name=~w&arity=~w',
[Encoded, Arity])
},
html(a(href(Href), [Name, /, Arity])).
https://www.swi-prolog.org/pldoc/man?section=html-write-examples
But www_form_encode/2 and sformat/3 are both deprecated.