If I understand LWP::Simple
's example script and implementation correctly, I think you're meant to handle a case like this by either...
Setting .force_encoding
to use a less strict encoding:
use LWP::Simple;
my $lwp = LWP::Simple.new;
$lwp.force_encoding = 'utf8-c8';
say $lwp.get('http://www.google.com');
utf8
(the default) = UTF8, with invalid bytes causing an exception.
utf8-c8
= UTF8 with pass-through for invalid bytes.
Setting .force_no_encode
to get the result as a Buf
:
use LWP::Simple;
my $lwp = LWP::Simple.new;
$lwp.force_no_encode = True;
say $lwp.get('http://www.google.com');
I can't test it though, because LWP::Simple
(installed with zef) doesn't work at all for me. (Not sure if the problem is with my Perl 6 set-up.)
My impression is that this module is not very polished right now. It's not just the lack of documentation – the API also appears to have been partially cargo-cult copied from the Perl 5 module (even parts that make less sense in Perl 6), and partially evolved by different committers adding features here and there without much design focus.