[babel-devel] octets-to-string with UTF8 and Byte Order Marker
Rob Blackwell
rob.blackwell at aws.net
Wed Apr 6 10:07:23 UTC 2011
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/babel-devel/attachments/20110406/adf89210/attachment.html>
More information about the babel-devel
mailing list