[drakma-devel] Bug handling bad html?

Anton Vodonosov vodonosov at mail.ru
Sun Feb 25 17:43:26 UTC 2007


You misunderstand meaning of *substitution-char*.
This is the character that will be used as a
substitution for all badly encoded characters.

Thus, this example is equvalent to
(setq flexi-streams::*provide-use-value-restart* t)
(setf flexi-streams::*SUBSTITUTION-CHAR* \?)

You will have ? instead of any wrong character.

I.e. you can use the whatever mechanism you like:
*substitution-char* for most cases or use-value-restart
if you whant more control (for example you what to
use ? as a substitution for even wrong byte sequence,
and * for odd wrong byte sequence; count encoding errors,
log them into file or something)

Read the docs, http://weitz.de/flexi-streams/

-Anton

Jeffrey Cunningham:
> On Sun Feb 25, 2007 at 07:00:03PM +0200, Anton Vodonosov wrote:
>> Hi, Jeff.
>>
>> "Signaling an error" means in this case that
>> work can be proceeded.
>>
>> (setq *provide-use-value-restart* t)
>>
>> (handler-bind
>>   ((flexi-stream-encoding-error (lambda (condition) 
>>
>>                                   (use-value \?))))
>>               (drakma:http-request("http://bad-host/bad-page.html")))
>>
>>
>> This is example from flexi-stream documentation.
>>
>> You can easy get "the best approximation of the content"
>> using drakma, but with more control. So it is unclear to my,
>> what problems you have.
>>
>> -Anton
> 
> Hi Anton,
> 
> Thanks for the help. Will the example above work for any bad
> charactor, or only the one set by
> 
> (setf flexi-streams::*SUBSTITUTION-CHAR* (code-char #xA0))
> 
> The only example I've run across is the site I mentioned, but it seems
> like the possibilities for bad html are endless.
> 
> --Jeff
> _______________________________________________
> drakma-devel mailing list
> drakma-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
> 
> 




More information about the Drakma-devel mailing list