sub xml_compliance {
my ($self, $field) = @_;
$field =~ s/&/&/g;
$field =~ s/</g;
$field =~ s/>/>/g;
$field =~ s/"/"/g;
$field =~ s/'/'/g;
return $field;
}
####
Entity: line 15: parser error : Input is not proper UTF-8, indicate encoding !
##
##
sub xml_compliance {
my ($self, $field) = @_;
my $fixed = "";
my $h_translate = {
'&' => '&',
'<' => '<',
'>' => '>',
'"' => '"',
"'" => ''',
};
my @chars = split //, $field;
foreach my $char (@chars) {
if (exists $h_translate->{$char}) {
$fixed .= $h_translate->{$char};
} elsif (ord($char) > 0x7f) {
# This is where we handle all non 7-bit ascii
$fixed .= sprintf "%02x;", ord($char);
} else {
$fixed .= $char;
}
}
return $fixed;
}