Open tothtamas28 opened 1 year ago
@tothtamas28 is there any good reason you'd need support for "🙂"? We restricted strings to latin1 characters because of the bytearray encoding issues.
is there any good reason you'd need support for "🙂"
Textual KORE supports arbitrary Unicode characters in string literals. When designing the KORE JSON representation, we decided not to double-encode, thus both
{
"tag": "DV",
"sort": {
"tag": "SortApp",
"name": "SortString",
"args": []
},
"value": "\ud83d\ude42"
}
and
{
"tag": "DV",
"sort": {
"tag": "SortApp",
"name": "SortString",
"args": []
},
"value": "🙂"
}
are valid KORE JSON. The tool scripts/generate-json-examples.sh
also generates such input.
To prevent encoding issues between components, I wrote a few integration tests, and some of them are failing because of this: https://github.com/runtimeverification/pyk/pull/333
We restricted strings to latin1 characters
You mean "🙂"
should be represented as "\ud83d\ude42"
?
because of the bytearray encoding issues
Can you point me to the issue?
I believe https://github.com/runtimeverification/hs-backend-booster/issues/92 is the issue. @goodlyrottenapple or @jberthold can probably provide better context than I can.
It has been proven to be very difficult to support ByteArrays as well as Unicode. It also seems that the LLVM backend does not support Unicode, and since the booster depends on frequent communication with the LLVM backend it would be very tricky to implement Unicode just for the Haskell backends.
Unless this is high priority I don't think we have the resources to tackle this issue right now, at least on the Haskell backend side.
For a request that contains Unicode characters within a string (either escaped or not),
kore-rpc
returns error-32602 Invalid params
.Steps to reproduce
string-rewrite.k request.json
The error is due to
on lines 40-47 of
request.json
. If the value is changed tothe error is still there. Note that both strings are well-formed JSON strings (standard, see section 2.5).
If the value it's changed to
the request works as expected: