-
Notifications
You must be signed in to change notification settings - Fork 8
Codec.string should fail on chars >=256 #79
Comments
I'm a little surprised. I thought that everything above 128 gets escaped:
|
It's hard to be sure because I don't know how to see a stack trace for the ML side. But I suspect the following happens:
As far as I understand, strings in ML cannot have code positions >=256, so there is no valid interpretation of Usually, one should not need non-ASCII strings in Isabelle anyway because it uses (One can convert a certain fragment of Unicode to symbols and back, https://github.com/dominique-unruh/qrhl-tool/blob/1f1f94f2ec7e86d6867f55495026458c5fdf21d8/src/main/scala/qrhl/isabelle/Isabelle.scala#L566 and https://github.com/dominique-unruh/qrhl-tool/blob/1f1f94f2ec7e86d6867f55495026458c5fdf21d8/src/main/scala/qrhl/isabelle/Isabelle.scala#L547 contain code for that.) |
Okay, I can see that now. Could you PR the change? |
To make a PR I would have to set up the whole libisabelle build.
|
Currently, Codec.string.encode will send any string passed to it to Isabelle.
However, Isabelle can only handle character codes 0-255. Anything else leads to a Chr exception being thrown in Isabelle. (By function Char.chr.)
For example system.invoke(Operation.Hello)("α") will fail.
I think Codec.string.encode should already raise an exception if the input contains chars >=256 since otherwise one gets a hard to track down exception (The exception from Char.chr comes without any information why this exception is raised.)
The text was updated successfully, but these errors were encountered: