I use wget to read a page from the web. But sometimes I get gzipped binary stream instead of plain text html file. What is the best way to decide if the data I get is binary or plain text? If I try to match the data with letter or number (text), I simply get "Malformed UTF-8".
my $result = run << wget -k -q -O $aPage "$aURL" >>, :err;
I need to know if $result is binary (gzip) or plain text.
if $result ~~ / <:L + :N> / { } # this will fail with "Malformed UTF-8" if $result is a binary stream
***** Is there a Raku package to get a plain text html page source from ANY url?
Thanks.