Hi,
I came around this, the other day:
(: results in � (some (unknown?) binary char) :) declare function local:test1($string) { xs:hexBinary($string) };
(: results in *[convert:string] String conversion: Decoding error: xff.* :) declare function local:test2($string) { convert:binary-to-string(xs:hexBinary($string)) };
(: results in � :) declare function local:test3($string) { xs:hexBinary($string) ,convert:binary-to-string(xs:hexBinary($string), "UTF-8", true()) };
let $input1 := "c3"
let $input2 := "28"
return ( local:test3($input1), local:test3($input2) )
I came around this, when I wanted to unescape an IRI by converting the 2 digits after the '%' to their character representation. What buffles me the most is, that in local:test1#1 I get the unrecognizable binary char for the xs:hexBinary call. If, however, as done in local:test2#1 the very same expression becomes part of a sequence, then I get back the desired character. And if I use convert:binary-to-string#1 I get an error, while using the 3-arity version, I do not get the error, but the unreadable binary char.
How can I simply get back any character, readable by a human, from a hexadecimal value?