I have a Text
object that contains some number of Latin characters that needs to be converted to a unicode escape sequence of the format \u####
with #
being hex digits
As described here, haskell easily converts strings to escape sequences and vice versa. However, it will only go to the decimal representation. For example,
> let s = "Ñ"
> s
"\209"
Is there a way to specify the escape sequence encoding to force it to spit out in the correct format? i.e
> let s = encodeUnicode16 "Ñ"
> s
"\u00d1"