I get an ASCII stream decoding error when I run this:
(with-open-file (stream file)
(net.html.parser:parse-html stream))
I'm using SBCL 1.0.58 and cl-html-parse 20101006 (using quicklisp).
I get the error fairly frequently trying to parse pages I download with curl (in a regular shell). Most are UTF-8.
Should I somehow be specifying an encoding for the file, and how would I do that?
After reading a bit more on with-open-file, I found I can make this work by specifying :external-format.
(with-open-file (stream file
:if-does-not-exist nil
:external-format :UTF-8)
(net.html.parser:parse-html stream))
Still trying to figure out writing (I get a similar error), but I think I'm looking in the right place now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With