Get the character encoding of a feed
Copy this code and paste it in your HTML
use LWP::Simple;
sub getfeedencoding {
#takes: feed url
#returns: feed encoding based on what it says about itself in the XML header
#sample string: encoding="UTF-8"
my $pagecontent = get($feedurl);
$pagecontent =~ m{encoding
="(.*?)"};
}
Report this snippet