I have a JS promise returning an object with property names in Ukrainian. Trying to use := to convert it to Prolog dictionary works, but the names of properties become malformed.
For example, {елемент: “Стринг”} becomes {‘елеменÑ\u0082’:“Стринг”}.
A working example below. WASM-compiled swipl-bundle-devel.js should be placed in the same directory with the html file when running an http server.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF8">
<title>Unicode in := </title>
</head>
<body>
<script src="swipl-bundle-devel.js"></script>
<script charset="utf-8">
var swipl;
async function run_prolog()
{
swipl = await SWIPL({arguments: ["-q"]})
await swipl.prolog.load_scripts()
await swipl.prolog.forEach("test.")
}
promise_unicode_dict = new Promise(resolve => {resolve({елемент: "Стринг"})})
run_prolog()
</script>
<script type="text/prolog" id="test.pl">
test :-
Promise := promise_unicode_dict, await(Promise, Dict),
writeln(Dict.елемент).
</script>
</body>
</html>