#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); use CGI::Carp; use WWW::Mechanize; use XML::Simple; use YAML; use Encode; my $mech = WWW::Mechanize->new; my $api_base = 'http://api.bookmooch.com/api/userid'; my $q = CGI->new; my $user = $q->param('user'); $mech->get("$api_base?userids=$user"); die "Failed to get user $user from BookMooch" unless $mech->success; print header, start_html, "\n" ; my $xml = $mech->content; # $xml = encode('iso-8859-1', $xml); (doesn't fix the problem) my $data = XMLin($xml); print pre(Dump($data)), end_html; #### Content-Type: text/html; charset=ISO-8859-1 Untitled Document :1492: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x31 0x20 0x31 Good condition. 1970 edition with net cover price shown as 1 15s ^ at /usr/lib/perl5/XML/LibXML/SAX/Parser.pm line 31