Hi,
I have some byte arrays which are UTF8 and some which are UTF8 with byte order markers.
I can convert these arrays to strings using
(babel:octets-to-string foo)
and
(babel:octets-to-string foo :start 3)
respectively, but I'm currently having to figure out whether there is a BOM, like this
(subseq foo 0 3)
#(239 187 191)
If I use (babel:octets-to-string foo) on a byte array with BOM markers, then my SBCL Lisp image dies.
Is there a better way to ask Babel to discover the correct encoding by looking for Byte Order Marks? Ideally I'd like one function call that worked with any array and figured out which encoding was being used automatically and works whether or not a BOM is present?
Sorry if I'm missing something obvious, I'm a Babel newbie .. Any guidance or code samples gratefully received.
Thanks,
Rob.